由于JAVA中基本数据类型均为有符号数,而且最大数据类型long为8字节假如long为负数时,最高位为1,转为无符号数时会超出long的取值范围,所以转换规则如下: 方法: public static final BigDecimal readUnsignedLong(long value) throws IOException { if (value >= 0) return new BigDecimal(value); long lowValue = value & 0x7fff
http://darksleep.com/player/JavaAndUnsignedTypes.html —————————————————————————————————————————————————————————————— Java and unsigned int, unsigned short, unsigned byte, unsigned long, etc. (Or rather, the lack thereof) Written by Sean R. Owens, sea