public static int[] subArray(final int[] input,final int start,final int end){
  int[] result=new int[end - start];
  System.arraycopy(input,start,result,0,end - start);
  return result;
}

public static int [ ] subArray ( final int [ ] input , final int start , final int end ) { int [ ] result = new int [ end - start ] ; System . arraycopy ( input , start , result , 0 , end - start ) ; return result ; }
generates a subarray of a given int array .
