private Object cloneArray(Object array){
  Class<?> type=array.getClass();
  if (type == byte[].class) {
    byte[] byteArray=(byte[])array;
    return byteArray.clone();
  }
  if (type == char[].class) {
    char[] charArray=(char[])array;
    return charArray.clone();
  }
  if (type == double[].class) {
    double[] doubleArray=(double[])array;
    return doubleArray.clone();
  }
  if (type == float[].class) {
    float[] floatArray=(float[])array;
    return floatArray.clone();
  }
  if (type == int[].class) {
    int[] intArray=(int[])array;
    return intArray.clone();
  }
  if (type == long[].class) {
    long[] longArray=(long[])array;
    return longArray.clone();
  }
  if (type == short[].class) {
    short[] shortArray=(short[])array;
    return shortArray.clone();
  }
  if (type == boolean[].class) {
    boolean[] booleanArray=(boolean[])array;
    return booleanArray.clone();
  }
  Object[] objectArray=(Object[])array;
  return objectArray.clone();
}

private Object cloneArray ( Object array ) { Class < ? > type = array . getClass ( ) ; if ( type == byte [ ] . class ) { byte [ ] byteArray = ( byte [ ] ) array ; return byteArray . clone ( ) ; } if ( type == char [ ] . class ) { char [ ] charArray = ( char [ ] ) array ; return charArray . clone ( ) ; } if ( type == double [ ] . class ) { double [ ] doubleArray = ( double [ ] ) array ; return doubleArray . clone ( ) ; } if ( type == float [ ] . class ) { float [ ] floatArray = ( float [ ] ) array ; return floatArray . clone ( ) ; } if ( type == int [ ] . class ) { int [ ] intArray = ( int [ ] ) array ; return intArray . clone ( ) ; } if ( type == long [ ] . class ) { long [ ] longArray = ( long [ ] ) array ; return longArray . clone ( ) ; } if ( type == short [ ] . class ) { short [ ] shortArray = ( short [ ] ) array ; return shortArray . clone ( ) ; } if ( type == boolean [ ] . class ) { boolean [ ] booleanArray = ( boolean [ ] ) array ; return booleanArray . clone ( ) ; } Object [ ] objectArray = ( Object [ ] ) array ; return objectArray . clone ( ) ; }
this method , which clones its array argument , would not be necessary if cloneable had a public clone method .
