question: public static Object [ ] resizeIfNeeded ( Object [ ] arr , int minSize , boolean doPowerOf2 ) { if ( arr . length >= minSize ) return arr ; if ( doPowerOf2 ) minSize = MathUtil . nextPowerOf2 ( minSize ) ; Object [ ] result = new Object [ minSize ] ; System . arraycopy ( arr , 0 , result , 0 , arr . length ) ; return result ; }
target:  this method returns the original array if its length is equal or greater than the minSize, or create a new array and copies the data from the original array into the new one.