public static int[] copyFrom(int[] array,int newLength){
  int[] copy=(int[])Array.newInstance(Integer.TYPE,newLength);
  System.arraycopy(array,0,copy,0,Math.min(array.length,newLength));
  return copy;
}

public static int [ ] copyFrom ( int [ ] array , int newLength ) { int [ ] copy = ( int [ ] ) Array . newInstance ( Integer . TYPE , newLength ) ; System . arraycopy ( array , 0 , copy , 0 , Math . min ( array . length , newLength ) ) ; return copy ; }
creates a copy of given array with the given newlength , and of type int [ ] .
