private int adjustByteCount(final int offset,final int count){
  final int available=Math.max(0,mSize - offset);
  return Math.min(available,count);
}

private int adjustByteCount ( final int offset , final int count ) { final int available = Math . max ( 0 , mSize - offset ) ; return Math . min ( available , count ) ; }
computes number of bytes that can be safely read / written starting at given offset , but no more than count .
