public void copy ( IntArray to ) { if ( length ( ) != to . length ( ) ) { throw new IllegalArgumentException ( "array not same size" ) ; } if ( buffer . hasArray ( ) && to . buffer . hasArray ( ) && buffer . array ( ) . getClass ( ) . getComponentType ( ) == to . buffer . array ( ) . getClass ( ) . getComponentType ( ) ) { System . arraycopy ( to . buffer . array ( ) , 0 , buffer . array ( ) , 0 , length ( ) ) ; } else { int len = length ( ) ; for ( int ii = 0 ; ii < len ; ii ++ ) { put ( ii , to . get ( ii ) ) ; } } }
Copies given IntArrays values to this . Throws IllegalArgumentException if lengths are not same .