I have this string 11110000, which represents a byte.
I want to create a byte from that string, but I can't find any example on-line.
Can someone please help me?
int value = Integer.parseInt(s, 2); // 2 for binary
If you want byte type:
byte value = Byte.parseByte(s, 2); // 2 for binary
Use Byte#parseByte().
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With