package com.ld.igds.weather; /** * @Desc: * @author: andy.jia * @update-time: 2023/4/23 19:26 */ public class ServerUtils { public static final String MSG_START = "AABB"; public static final String MSG_END = "EEEE"; public static String getServerKey(String ip, int port) { return ip + ":" + port; } /** * 十六进制串转字节数组 * * @param hexStr * @return */ public static byte[] hexStrToBytes(String hexStr) { int size = hexStr.length() / 2; byte[] bytes = new byte[size]; for (int i = 0; i < size; i++) { String tmp = hexStr.substring(i * 2, (i + 1) * 2); Integer tmpHex = Integer.parseInt(tmp, 16); bytes[i] = tmpHex.byteValue(); } return bytes; } }