/home/caleb/ASDV-Java/Assignments/lab16_arrays2_CalebFontenot/src/main/java/com/calebfontenot/lab16_arrays2_calebfontenot/ArrayShift1.java |
package com.calebfontenot.lab16_arrays2_calebfontenot;
@author
public class ArrayShift1 {
public static void main(String[] args)
{
int[] ar = {1, 2, 3, 4, 5};
int temp = ar[0];
for (int value : ar) {
System.out.print(value + " ");
}
System.out.println();
for (int i = 1; i < ar.length; ++i) {
ar[i - 1] = ar[i];
}
ar[ar.length - 1] = temp;
for (int value : ar) {
System.out.print(value + " ");
}
}
}