package design.util;
import java.math.BigInteger;
public class Util {
/**
* @description 将二进制转换成16进制
*
* @param buf
* @return
*/
public static String byte2HexStr(byte[] buf) {
StringBuffer sb = new StringBuffer();
for (int i = 0; i < buf.length; i++) {
String hex = Integer.toHexString(buf[i] & 0xFF);
if (hex.length() == 1) {
hex = '0' + hex;
}
sb.append(hex.toUpperCase());
}
return sb.toString();
}
/**
* @description 将16进制转换为二进制
*
* @param hexStr
* @return
*/
public static byte[] hexStr2Byte(String hexStr) {
if (hexStr.length() < 1)
return null;
byte[] result = new byte[hexStr.length() / 2];
for (int i = 0; i < hexStr.length() / 2; i++) {
int high = Integer.parseInt(hexStr.substring(i * 2, i * 2 + 1), 16);
int low = Integer.parseInt(hexStr.substring(i * 2 + 1, i * 2 + 2), 16);
result[i] = (byte) (high * 16 + low);
}
return result;
}
/**
* 十六进制转换为十进制
* @param: hex
* @return: int
* @description: 按位计算,位值乘权重
*/
public static long hexToDec(String hex){
long outcome = 0;
for(int i = 0; i < hex.length(); i++){
char hexChar = hex.charAt(i);
outcome = outcome * 16 + charToDecimal(hexChar);
}
return outcome;
}
/**
* @param: [c]
* @return: int
* @description:将字符转化为数字
*/
public static long charToDecimal(char c){
if(c >= 'A' && c <= 'F')
return 10 + c - 'A';
else
return c - '0';
}
/**
* 十进制转换为十六进制
* @param n
* @return
*/
public static String decToHex(int n){
String r="";//定义字符串并初始化
while(n>0){//只要输入的十进制大于0,就一直循环
int yushu=n%16;
//16进制表示0~9,'A','B','C','D','E','F'
if(yushu >9){//余数大于9,
char c=(char)(yushu-10+'A');//这块要强转为字符型
r+=c;
}else{
r+=yushu;
}
n=n/16;
}
return reverse(r);//调用反转字符串函数
}
//反转字符串
public static String reverse(String s){
int length=s.length();
String r="";
for(int i=length-1;i>=0;i--){
r+=s.charAt(i);//charAt(int)表示返回char指定索引处的值
}
return r;
}
/**
* 接收到的字节数组转换16进制字符串
* @param b
* @param size
* @return
*/
public static String byteToStr(byte[] b, int size) {
String ret = "";
for (int i = 0; i < size; i++) {
String hex = Integer.toHexString(b[i] & 0xFF);
if (hex.length() == 1) {
hex = '0' + hex;
}
ret += hex.toUpperCase();
}
return ret;
}
/**
* 将16进制字符串转换为byte[]
*
* @param str
* @return
*/
public static byte[] toBytes(String str) {
byte[] bytes = new BigInteger(str, 16).toByteArray();
return bytes;
}
/**
* 计算CRC16校验
* @Description:
* @param data 需要计算的数组
* @param start 开始计算位置
* @param len 长度
* @return CRC16校验值
*/
public static byte[] CRC16(byte[] data)
{
byte[] crc16_h = {
(byte)0x00, (byte)0x10, (byte)0x20, (byte)0x30, (byte)0x40, (byte)0x50, (byte)0x60, (byte)0x70,
(byte)0x81, (byte)0x91, (byte)0xA1, (byte)0xB1, (byte)0xC1, (byte)0xD1, (byte)0xE1, (byte)0xF1,
(byte)0x12, (byte)0x02, (byte)0x32, (byte)0x22, (byte)0x52, (byte)0x42, (byte)0x72, (byte)0x62,
(byte)0x93, (byte)0x83, (byte)0xB3, (byte)0xA3, (byte)0xD3, (byte)0xC3, (byte)0xF3, (byte)0xE3,
(byte)0x24, (byte)0x34, (byte)0x04, (byte)0x14, (byte)0x64, (byte)0x74, (byte)0x44, (byte)0x54,
(byte)0xA5, (byte)0xB5, (byte)0x85, (byte)0x95, (byte)0xE5, (byte)0xF5, (byte)0xC5, (byte)0xD5,
(byte)0x36, (byte)0x26, (byte)0x16, (byte)0x06, (byte)0x76, (byte)0x66, (byte)0x56, (byte)0x46,
(byte)0xB7, (byte)0xA7, (byte)0x97, (byte)0x87, (byte)0xF7, (byte)0xE7, (byte)0xD7, (byte)0xC7,
(byte)0x48, (byte)0x58, (byte)0x68, (byte)0x78, (byte)0x08, (byte)0x18, (byte)0x28, (byte)0x38,
(byte)0xC9, (byte)0xD9, (byte)0xE9, (byte)0xF9, (byte)0x89, (byte)0x99, (byte)0xA9, (byte)0xB9,
(byte)0x5A, (byte)0x4A, (byte)0x7A, (byte)0x6A, (byte)0x1A, (byte)0x0A, (byte)0x3A, (byte)0x2A,
(byte)0xDB, (byte)0xCB, (byte)0xFB, (byte)0xEB, (byte)0x9B, (byte)0x8B, (byte)0xBB, (byte)0xAB,
(byte)0x6C, (byte)0x7C, (byte)0x4C, (byte)0x5C, (byte)0x2C, (byte)0x3C, (byte)0x0C, (byte)0x1C,
(byte)0xED, (byte)0xFD, (byte)0xCD, (byte)0xDD, (byte)0xAD, (byte)0xBD, (byte)0x8D, (byte)0x9D,
(byte)0x7E, (byte)0x6E, (byte)0x5E, (byte)0x4E, (byte)0x3E, (byte)0x2E, (byte)0x1E, (byte)0x0E,
(byte)0xFF, (byte)0xEF, (byte)0xDF, (byte)0xCF, (byte)0xBF, (byte)0xAF, (byte)0x9F, (byte)0x8F,
(byte)0x91, (byte)0x81, (byte)0xB1, (byte)0xA1, (byte)0xD1, (byte)0xC1, (byte)0xF1, (byte)0xE1,
(byte)0x10, (byte)0x00, (byte)0x30, (byte)0x20, (byte)0x50, (byte)0x40, (byte)0x70, (byte)0x60,
(byte)0x83, (byte)0x93, (byte)0xA3, (byte)0xB3, (byte)0xC3, (byte)0xD3, (byte)0xE3, (byte)0xF3,
(byte)0x02, (byte)0x12, (byte)0x22, (byte)0x32, (byte)0x42, (byte)0x52, (byte)0x62, (byte)0x72,
(byte)0xB5, (byte)0xA5, (byte)0x95, (byte)0x85, (byte)0xF5, (byte)0xE5, (byte)0xD5, (byte)0xC5,
(byte)0x34, (byte)0x24, (byte)0x14, (byte)0x04, (byte)0x74, (byte)0x64, (byte)0x54, (byte)0x44,
(byte)0xA7, (byte)0xB7, (byte)0x87, (byte)0x97, (byte)0xE7, (byte)0xF7, (byte)0xC7, (byte)0xD7,
(byte)0x26, (byte)0x36, (byte)0x06, (byte)0x16, (byte)0x66, (byte)0x76, (byte)0x46, (byte)0x56,
(byte)0xD9, (byte)0xC9, (byte)0xF9, (byte)0xE9, (byte)0x99, (byte)0x89, (byte)0xB9, (byte)0xA9,
(byte)0x58, (byte)0x48, (byte)0x78, (byte)0x68, (byte)0x18, (byte)0x08, (byte)0x38, (byte)0x28,
(byte)0xCB, (byte)0xDB, (byte)0xEB, (byte)0xFB, (byte)0x8B, (byte)0x9B, (byte)0xAB, (byte)0xBB,
(byte)0x4A, (byte)0x5A, (byte)0x6A, (byte)0x7A, (byte)0x0A, (byte)0x1A, (byte)0x2A, (byte)0x3A,
(byte)0xFD, (byte)0xED, (byte)0xDD, (byte)0xCD, (byte)0xBD, (byte)0xAD, (byte)0x9D, (byte)0x8D,
(byte)0x7C, (byte)0x6C, (byte)0x5C, (byte)0x4C, (byte)0x3C, (byte)0x2C, (byte)0x1C, (byte)0x0C,
(byte)0xEF, (byte)0xFF, (byte)0xCF, (byte)0xDF, (byte)0xAF, (byte)0xBF, (byte)0x8F, (byte)0x9F,
(byte)0x6E, (byte)0x7E, (byte)0x4E, (byte)0x5E, (byte)0x2E, (byte)0x3E, (byte)0x0E, (byte)0x10
};
byte[] crc16_l = {
(byte)0x00, (byte)0x21, (byte)0x42, (byte)0x63, (byte)0x84, (byte)0xA5, (byte)0xC6, (byte)0xE7,
(byte)0x08, (byte)0x29, (byte)0x4A, (byte)0x6B, (byte)0x8C, (byte)0xAD, (byte)0xCE, (byte)0xEF,
(byte)0x31, (byte)0x10, (byte)0x73, (byte)0x52, (byte)0xB5, (byte)0x94, (byte)0xF7, (byte)0xD6,
(byte)0x39, (byte)0x18, (byte)0x7B, (byte)0x5A, (byte)0xBD, (byte)0x9C, (byte)0xFF, (byte)0xDE,
(byte)0x62, (byte)0x43, (byte)0x20, (byte)0x01, (byte)0xE6, (byte)0xC7, (byte)0xA4, (byte)0x85,
(byte)0x6A, (byte)0x4B, (byte)0x28, (byte)0x09, (byte)0xEE, (byte)0xCF, (byte)0xAC, (byte)0x8D,
(byte)0x53, (byte)0x72, (byte)0x11, (byte)0x30, (byte)0xD7, (byte)0xF6, (byte)0x95, (byte)0xB4,
(byte)0x5B, (byte)0x7A, (byte)0x19, (byte)0x38, (byte)0xDF, (byte)0xFE, (byte)0x9D, (byte)0xBC,
(byte)0xC4, (byte)0xE5, (byte)0x86, (byte)0xA7, (byte)0x40, (byte)0x61, (byte)0x02, (byte)0x23,
(byte)0xCC, (byte)0xED, (byte)0x8E, (byte)0xAF, (byte)0x48, (byte)0x69, (byte)0x0A, (byte)0x2B,
(byte)0xF5, (byte)0xD4, (byte)0xB7, (byte)0x96, (byte)0x71, (byte)0x50, (byte)0x33, (b
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
<项目介绍> 基于Java的现场快递柜状态采集与控制系统后端源码(大学课设).zip 该资源内项目源码是个人的毕设,代码都测试ok,都是运行成功后才上传资源,答辩评审平均分达到94.5分,放心下载使用! 该资源适合计算机相关专业(如人工智能、通信工程、自动化、软件工程等)的在校学生、老师或者企业员工下载,适合小白学习或者实际项目借鉴参考! 当然也可作为毕业设计、课程设计、课程作业、项目初期立项演示等。如果基础还行,可以在此代码基础之上做改动以实现更多功能。 大学课程设计项目,采用Spring框架,通过串口通信更新数据库中信息并通过前端展示出来。 软件架构 前端请看:csdn另外资源。基于JavaScript+Vue的现场快递柜状态采集与控制系统前端源码.zip
资源推荐
资源详情
资源评论
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
收起资源包目录
![package](https://csdnimg.cn/release/downloadcmsfe/public/img/package.f3fc750b.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JAR.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JAR.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JAR.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JAR.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JAR.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JAR.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JAR.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JAR.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JAR.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JAR.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JAR.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JAR.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JAR.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JAR.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JAR.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JAR.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JAR.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JAR.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JAR.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JAR.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JAR.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JAR.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JAR.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JAR.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JAR.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JAR.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JAR.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JAR.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JAR.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JAR.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JAR.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JAR.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JAR.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JAR.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JAR.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JAR.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JAR.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JAR.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JAR.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JAR.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JAR.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JAR.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JAR.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JAR.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JAR.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JAR.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JAR.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JAR.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JAR.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JAR.png)
共 231 条
- 1
- 2
- 3
资源评论
![avatar-default](https://csdnimg.cn/release/downloadcmsfe/public/img/lazyLogo2.1882d7f4.png)
![avatar](https://profile-avatar.csdnimg.cn/9fb63100393143b2bf2ab5435959ddba_deeplearning_.jpg!1)
极客程序设计
- 粉丝: 7534
- 资源: 3596
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助
![voice](https://csdnimg.cn/release/downloadcmsfe/public/img/voice.245cc511.png)
![center-task](https://csdnimg.cn/release/downloadcmsfe/public/img/center-task.c2eda91a.png)
安全验证
文档复制为VIP权益,开通VIP直接复制
![dialog-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/green-success.6a4acb44.png)