Imagine that I have this class:
public class Test { private String[] arr = new String[]{\"1\",\"2\"}; public String[] getArr() { return arr;
at this point of view you should use system array copy:
public String[] getArr() { if (arr != null) { String[] arrcpy = new String[arr.length]; System.arraycopy(arr, 0, arrcpy, 0, arr.length); return arrcpy; } else return null; } }