I'm trying to simulate a Hamming-Code 4,7 which is working properly. I'm working with boolean arrays insted of really bits to simplify it a bit logically. I input some Characters, there converted to ASCII and the Simulation goes on. After all I end up with an BooleanArray of length numberofcharacters*8 where every [] equals one bit. This method should just reconvert this back to ascii code and it work semiproperly. If the ASCII number is even, erverything is fine, but when it's odd the last bit it always 'forgotten'. Thanks for your help
Dear Simon
private static String booleantoString(boolean[] bool){
int[] array = new int[bool.length/8];
for(int a=0;a<bool.length/8;a++){
for(int n = a*8; n<(a*8+7); n++){
if(bool[n] == true){
array[a] = setBit(array[a],0);
}
array[a] <<= 1;
}
System.out.print("ASCII-Code: " + array[a]+ " ");
System.out.print("Zeichen: " +(char)array[a] + " ");
}
return s;
}