public BlockInfo [ ] getParityBlocks ( BlockInfo [ ] blocks ) { int numBlocks = ( blocks . length / numStripeBlocks ) * numParityBlocks + ( ( blocks . length % numStripeBlocks == 0 ) ? 0 : numParityBlocks ) ; BlockInfo [ ] parityBlocks = new BlockInfo [ numBlocks ] ; int pos = 0 ; int parityEnd = numParityBlocks ; for ( int i = 0 ; i < numBlocks ; i ++ ) { parityBlocks [ i ] = blocks [ pos ] ; pos ++ ; if ( pos == parityEnd ) { pos += numDataBlocks ; parityEnd += numStripeBlocks ; } } return parityBlocks ; }
Return only the parity blocks of the raided file