public static int computeBlockSize(long len,long blockIndex,long blockSize){
  long remain=len - (blockIndex - 1) * blockSize;
  return (int)Math.min(blockSize,remain);
}

public static int computeBlockSize ( long len , long blockIndex , long blockSize ) { long remain = len - ( blockIndex - 1 ) * blockSize ; return ( int ) Math . min ( blockSize , remain ) ; }
computes the actual block size based on matrix dimension , block index , and block size meta data . for boundary blocks , the actual block size is less or equal than the block size meta data ; otherwise they are identical .
