πThis is the Program of Reverse the Array it is very sufficient and easy way I am doing this code
package ds.Arrays;
import java.util.Arrays;
public class Reverse_The_Arrays_2 {
public static void main(String[] args) {
int arr[]=new int[] {10,20,30,40,50,60};
int i=0,j=arr.length-1;
while(i<j) {
int temp=arr[i];
arr[i]=arr[j];
arr[j]=temp;
i++;
j--;
}
System.out.println(Arrays.toString(arr));
}
}
Comments
Post a Comment