panlili2024
2024-09-19 071a8328823a2861f93ce556a4da3e4119cab1a3
HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/Utils/HDLUtlis/HDLUtlis.java
@@ -2,6 +2,7 @@
import java.math.BigDecimal;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
/**
 * Created by JLChen on 2019/7/25
@@ -10,6 +11,7 @@
    /**
     * 将object转为Integer类型
     *
     * @param object
     * @return
     */
@@ -35,6 +37,7 @@
    /**
     * int类型转4字节byte数组
     *
     * @param mInt
     * @return 4字节byte数组
     */
@@ -50,6 +53,7 @@
    /**
     * byte[]转int
     *
     * @param bytes
     * @return
     */
@@ -65,12 +69,12 @@
    public static float byte2Float(byte[] bytes) {
        if (bytes.length != 4) {
       /* if (bytes.length != 4) {
            return 0;
        }
        }*/
        byte b[] = bytes;
        ByteBuffer buf = ByteBuffer.allocateDirect(4);
//      buf=buf.order(ByteOrder.LITTLE_ENDIAN);小端用这行代码,默认大端转换
        buf = buf.order(ByteOrder.LITTLE_ENDIAN);//小端用这行代码,默认大端转换
        buf.put(b);
        buf.rewind();
        float f2 = buf.getFloat();
@@ -79,6 +83,7 @@
    /**
     * 调整int 类型参数
     *
     * @return progress
     */
    public static int getTrueProgressInt(int progress) {