1.新增字典功能
2.RocketMQ新增治理消息模板
This commit is contained in:
@@ -38,6 +38,9 @@ public interface ServerInfo {
|
||||
String CS_HARMONIC_BOOT = "cs-harmonic-boot";
|
||||
|
||||
String CS_REPORT_BOOT = "cs-report-boot";
|
||||
String CS_STAT_BOOT = "stat-boot";
|
||||
String CS_RT_BOOT = "rt-boot";
|
||||
String CS_ZL_EVENT_BOOT = "zl-event-boot";
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -473,5 +473,56 @@ public class PubUtils {
|
||||
return new String(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 将字节数组转成Float数组
|
||||
* @param bytes
|
||||
* @return
|
||||
*/
|
||||
public static List<Float> byteArrayToFloatList(byte[] bytes){
|
||||
List<Float> d = new ArrayList<>(bytes.length/8);
|
||||
byte[] doubleBuffer = new byte[4];
|
||||
for(int j = 0; j < bytes.length; j += 4) {
|
||||
System.arraycopy(bytes, j, doubleBuffer, 0, doubleBuffer.length);
|
||||
d.add(bytes2Float(doubleBuffer));
|
||||
}
|
||||
return d;
|
||||
}
|
||||
|
||||
public static float bytes2Float(byte[] arr) {
|
||||
int accum = 0;
|
||||
accum = accum|(arr[0] & 0xff);
|
||||
accum = accum|(arr[1] & 0xff) << 8;
|
||||
accum = accum|(arr[2] & 0xff) << 16;
|
||||
accum = accum|(arr[3] & 0xff) << 24;
|
||||
return Float.intBitsToFloat(accum);
|
||||
}
|
||||
|
||||
/**
|
||||
* 将字节数组转成Double数组
|
||||
* @param arr
|
||||
* @return
|
||||
*/
|
||||
public static List<Double> byteArrayToDoubleList(byte[] arr){
|
||||
List<Double> d = new ArrayList<>(arr.length/8);
|
||||
byte[] doubleBuffer = new byte[8];
|
||||
for(int j = 0; j < arr.length; j += 8) {
|
||||
System.arraycopy(arr, j, doubleBuffer, 0, doubleBuffer.length);
|
||||
d.add(bytes2Double(doubleBuffer));
|
||||
}
|
||||
return d;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将byte转换成double
|
||||
* @param arr
|
||||
* @return
|
||||
*/
|
||||
public static double bytes2Double(byte[] arr) {
|
||||
long value = 0;
|
||||
for (int i = 0; i < 8; i++) {
|
||||
value |= ((long) (arr[i] & 0xff)) << (8 * i);
|
||||
}
|
||||
return Double.longBitsToDouble(value);
|
||||
}
|
||||
//***************************************************添加结束********************************************************
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user