一定量のビットを知っている新しいバイトを作成しようとしています
char prostie1 = theRepChars[j-3];
char prostie2 = theRepChars[j-2];
char prostie3 = theRepChars[j-1];
char prostie4 = theRepChars[j];
String prostiaMare = prostie4 + prostie3 + prostie2 + prostie1 + "";
Byte theChar = new Byte(prostiaMare);
これを行うと、NumberFormatException 値 196 が返されます。
何が問題なのかわからない
- 編集 -
私はあまり明確ではなかったので、もう少し詳しく説明する必要があるかもしれません。Uuencode アルゴリズムを実行しようとしていますが、アルゴリズムのロジックに従って、194 より大きい値を持つバイトを停止する必要があります。これが私のコードの束です。
if(my_chars.length % 3 == 0)
{
for(int x = 0; x < my_chars.length; x++)
{
if((x+1) % 3 == 0)
{
char first = my_chars[x-2];
char second = my_chars[x-1];
char third = my_chars[x];
int n = (((first << 8) | second) << 8) | third;
String theRep = Integer.toBinaryString(n);
while(theRep.length() < 24 - 1)
{
theRep = 0 + theRep;
}
//0 padded theRep
for(int j = 0; j < theRepChars.length; j++)
{
if((j+1) % 4 == 0)
{
char prostie1 = theRepChars[j-3];
char prostie2 = theRepChars[j-2];
char prostie3 = theRepChars[j-1];
char prostie4 = theRepChars[j];
String prostiaMare = prostie4 + prostie3 + prostie2 + prostie1 + "";
System.out.println(prostiaMare);
}
}
}
}
}
そして、prostiaMare が持っている値で新しいバイトを作成しようとすると、numberFormatException が発生します。アルゴリズムに正しく従っていないかどうかはわかりません ( http://www.herongyang.com/encoding/UUEncode-Algorithm.html )