Junjie
2023-03-31 87c4efe93e6fe31a9c989b4aa5cc0c8f559b845d
src/main/java/com/zy/common/utils/CommonUtils.java
@@ -1,5 +1,7 @@
package com.zy.common.utils;
import com.core.common.RadixTools;
import java.math.BigDecimal;
/**
@@ -27,4 +29,19 @@
        }
    }
    //int转short数组
    public static short[] intToShorts(int num) {
        //先将int转为byte数组,再将byte数组转成两个short,分别占用4和5空间
        byte[] bytes = RadixTools.intToBytes(num);
        byte[] tmp1 = {bytes[0], bytes[1]};
        short byteToShort = RadixTools.byteToShort(tmp1);
        byte[] tmp2 = {bytes[2], bytes[3]};
        short byteToShort2 = RadixTools.byteToShort(tmp2);
        return new short[]{byteToShort2, byteToShort};
    }
    public static boolean shortToBoolean(Short num) {
        return num != 0;
    }
}