private int newSizeInWords ( int number ) { int size = this . actualSizeInWords + number ; if ( size >= this . buffer . length ) { if ( size < 32768 ) size = size * 2 ; else if ( size * 3 / 2 < size ) // overflow size = Integer . MAX_VALUE ; else size = size * 3 / 2 ; } return size ; }
Returns the resulting buffer size in words given the number of words to add .