Byte toUnsignedLong(byte x)
converts the byte to a long by an unsigned conversion.
Zero and positive byte values converts to an equal long value.
Negative byte values converts to a long value equal to the input + 256.
toUnsignedLong
has the following syntax.
public static long toUnsignedLong(byte x)
toUnsignedLong
has the following parameters.
toUnsignedLong
returns
the byte converted to long by an unsigned conversion
The following example shows how to use toUnsignedLong
.
/*from w ww .ja v a 2 s . c om*/ public class Main { public static void main(String...args){ byte b = 2; System.out.println(Byte.toUnsignedLong(b)); b = -2; System.out.println(Byte.toUnsignedLong(b)); } }
The code above generates the following result.