You can try using System.arraycopy()
int[] src = new int[]{1,2,3,4,5};
int[] dest = new int[5];
System.arraycopy( src, 0, dest, 0, src.length );
But, probably better to use clone() in most cases:
int[] src = ...
int[] dest = src.clone();
More Related Contents:
- How do I do a deep copy of a 2d array in Java?
- How do I copy a 2 Dimensional array in Java?
- Deep copy of an object array
- How do I use multidimensional arrays? [closed]
- Java sort 4 arrays into 1 array
- I keep getting java.lang.ArrayIndexOutOfBoundsException: 5! How do I fix this? [closed]
- Converting array string to arraylist without nesting it in Java
- Creating a program to file criminal cases and then view them, with new case being allowed to add
- Take a result of two long numbers using an array in Java [closed]
- Incrementing an array [closed]
- How do I declare and initialize an array in Java?
- How can I concatenate two arrays in Java?
- Copying files from one directory to another in Java
- How to create a generic array in Java?
- make arrayList.toArray() return more specific types
- Java: join array of primitives with separator
- How to find the index of an element in an int array?
- Splitting String and put it on int array
- Generics, arrays, and the ClassCastException
- Pascal’s triangle 2d array – formatting printed output
- Split a String at every 3rd comma in Java
- How to get unique items from an array?
- The easiest way to transform collection to array?
- Is it possible in Java to override ‘toString’ for an Objects array?
- What does java.lang.ArrayIndexOutOfBoundsException mean? [duplicate]
- Random element from string array [closed]
- Printing out a 2D array in matrix format
- Array of function pointers in Java [duplicate]
- How to convert a Java String to an ASCII byte array?
- Converting an int array to a String array