Converting 32-bit unsigned integer (big endian) to long and back

后端 未结 3 2051
北恋
北恋 2020-12-16 03:57

I have a byte[4] which contains a 32-bit unsigned integer (in big endian order) and I need to convert it to long (as int can\'t hold an unsigned number).

Also, how d

3条回答
  •  孤城傲影
    2020-12-16 04:38

    Guava has useful classes for dealing with unsigned numeric values.

    http://docs.guava-libraries.googlecode.com/git/javadoc/com/google/common/primitives/UnsignedInts.html#toLong(int)

提交回复
热议问题