List of utility methods to do Array Copy
boolean[] | copyOf(boolean[] obj, int newSize) copy Of boolean tempArr[] = new boolean[newSize]; System.arraycopy(obj, 0, tempArr, 0, Math.min(obj.length, newSize)); return tempArr; |
byte[] | copyOf(byte[] obj) copy Of return copyOf(obj, obj.length);
|
byte[] | copyOf(byte[] obj, int newSize) copy Of byte tempArr[] = new byte[newSize]; System.arraycopy(obj, 0, tempArr, 0, Math.min(obj.length, newSize)); return tempArr; |
byte[] | copyOf(byte[] source, int newLength) Copies the specified array, truncating or padding with zeros (if necessary) so the copy has the specified length. byte[] result = new byte[newLength]; System.arraycopy(source, 0, result, 0, Math.min(source.length, newLength)); return result; |
char[] | copyOf(char[] obj) copy Of return copyOf(obj, obj.length);
|
char[] | copyOf(char[] obj, int newSize) copy Of char tempArr[] = new char[newSize]; System.arraycopy(obj, 0, tempArr, 0, Math.min(obj.length, newSize)); return tempArr; |
double[] | copyOf(double[] obj) copy Of return copyOf(obj, obj.length);
|
double[] | copyOf(double[] obj, int newSize) copy Of double tempArr[] = new double[newSize]; System.arraycopy(obj, 0, tempArr, 0, Math.min(obj.length, newSize)); return tempArr; |
float[] | copyOf(float[] obj) copy Of return copyOf(obj, obj.length);
|
float[] | copyOf(float[] obj, int newSize) copy Of float tempArr[] = new float[newSize]; System.arraycopy(obj, 0, tempArr, 0, Math.min(obj.length, newSize)); return tempArr; |