Parse an unsigned byte in Java

byte b = (byte) Integer.parseInt("150");

System.out.println(Byte.toUnsignedInt(b)); // 150

Or, using Guava:

byte b = UnsignedBytes.parseUnsignedByte("150");

Comments

Be the first to comment!