Java Program to Reverse an Array without Additional Array - RameshMF/java-interview GitHub Wiki
http://www.speakingcs.com/2015/07/how-to-reverse-array-in-java-with-and.html
package com.ramesh.corejava.interview.programs;
/**
*
* @author RAMESH
*
*/
public class ReverseArrayWithoutAnotherArray {
public static void main(String[] args) {
int[] array = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
int middle = array.length / 2;
int temp;
int j = array.length -1;
for(int a : array){
System.out.println(" before reverse :: " + a);
}
for (int i = 0 ; i < middle; i++, j--) {
temp = array[i];
array[i] = array[j];
array[j] = temp;
}
for(int a : array){
System.out.println(" after reverse :: " + a);
}
}
}