public static void main(String[] args) { int[] a = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; int startI = 0; int endI = a.length - 1; while (startI <= endI) { int temp = a[startI]; a[startI] = a[endI]; a[endI] = temp; startI++; endI--; } System.out.println(JSON.toJSONString(a)); }