there is a string fill with 0 and 1,like String s = "10000000", which length is 8.And how can i transform it to a byte.such as "10000000"===>-128.
I try to use Byte.parseByte(s, 2),but get the error "Value out of range. Value:"10000000" Radix:2".So,how can i solve it.
-
2stackoverflow.com/questions/14883428/… , stackoverflow.com/questions/22649348 , stackoverflow.com/questions/29530015/…, stackoverflow.com/questions/28032458 - although if it's homework..user2864740– user28647402016-06-22 06:10:40 +00:00Commented Jun 22, 2016 at 6:10
-
Did you try using Integer.parseInt(s,2) ? The value you are using is out of bounds for Byte.vv88– vv882016-06-22 06:13:15 +00:00Commented Jun 22, 2016 at 6:13
Add a comment
|