gia provato e non funziona: ricevo sempre questo errore
codice:
Exception in thread "main" java.lang.NumberFormatException: Value out of range. Value:"01001101" Radix:10
comunque ho risolto, magari in maniera poco artistica, ma ora funziona, ecco come:
codice:
byte[] arr = new byte[str.length()/8]; // byte buffer
byte tmp; // byte used for computation
for(int i=0;i<str.length();i++) // for each bit
{
tmp = arr[i/8];
tmp = (byte)(((0xFF7F>>(i%8)) & tmp) & 0x00FF);
arr[i/8] = (byte)(((Integer.parseInt(str.substring(i,i+1)))<<(8-((i%8)+1))) | tmp);
//put it in the right byte and right position
}
ma se avete altre idee, vi ascolto... quel metodo mi pare cosi` poco elegante