// computing values for extra sector byte[] sectors = new byte[ 10, SECTOR_SIZE ]; // ... code to fill in values of sectors byte[] extra = new byte[ SECTOR_SIZE ]; for ( int i=0; i<SECTOR_SIZE; i++ ) { extra[i] = 0; for ( int j=0; j<10; j++ ) { extra[i] ^= sectors[ j, i ]; } }