public int [ ] get ( int size , boolean acceptGreater ) { Node < ArraysBySize > node ; int [ ] buf ; synchronized ( arraysBySize ) { if ( acceptGreater ) node = arraysBySize . searchNearestHigher ( size , true ) ; else node = arraysBySize . get ( size ) ; // limit to 3/2 of the size if ( node != null && acceptGreater && node . getValue ( ) > size * 3 / 2 ) node = null ; if ( node == null ) buf = null ; else { ArraysBySize arrays = node . getElement ( ) ; arrays . lastUsageTime = System . currentTimeMillis ( ) ; buf = arrays . arrays . poll ( ) ; if ( arrays . arrays . isEmpty ( ) ) arraysBySize . remove ( node ) ; } } if ( buf == null ) return new int [ size ] ; totalSize -= buf . length * 4 ; return buf ; }
Get an array .