void (String[] arr) { int newLength = 1; int oldLength = arr.length; if (oldLength != newLength) { arr = Arrays.copyOf(arr, newLength); } for (int i = 0; i < oldLength; i++) { String s = arr[i]; System.out.println(s); } }