-1
String s = "10000000"
のような0と1の文字列があります。長さは8です。どのようにしてbyte.suchを "10000000" ===> - 128に変換できますか? Byte.parseByte(s, 2)
を使用しようとしましたが、「値が範囲外です。値:」10000000「基数:2」です。どうすれば解決できますか。あなたはInteger
としてそれを解析して、バイトにキャストする必要がバイナリ文字列をバイトに変換するには?
http://stackoverflow.com/questions/14883428/java-convert- binary-string-to-int、http://stackoverflow.com/questions/22649348、http://stackoverflow.com/questions/29530015/java-converting-string-of-binary-digits-to-decimal-number- using-recursion?rq = 1、http://stackoverflow.com/questions/28032458 - 宿題の場合は – user2864740
Integer.parseInt(s、2)を使ってみましたか?使用している値は、Byteの範囲外です。 – vv88