/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
 */
package com.calebfontenot.lab16_arrays2_calebfontenot;

/**
 *
 * @author caleb
 */
public class ArrayShift2 {

    public static void main(String[] args)
    {
        int[] ar = {1, 2, 3, 4, 5};
        int temp = ar[ar.length - 1];
        
        for (int value : ar) {
            System.out.print(value + " ");
        }
        System.out.println();
        
        for (int i = (ar.length -1); i > 0 ; --i) {
            ar[i] = ar[i -1];
        }
        ar[0] = temp;

        for (int value : ar) {
            System.out.print(value + " ");
        }
    }
}
