/home/caleb/ASDV-Java/Assignments/lab15_CalebFontenot/src/lab15_calebfontenot/Array3.java

    /*
     * 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 lab15_calebfontenot;

    /**
     *
     * @author caleb
     */
    public class Array3 {
        public static void main(String[] args)
        {
            int[] values = new int[5];
            //Init array with correct value of i plus the value of the previous array element
            for (int i = 1; i < values.length; i++) {
                values[i] = i + values[i - 1];
            }

            // put in the first array element the second plus the last array elements
            values[0] = values[1] + values[values.length -1];

            // print the array
            for (int i = 0; i < values.length; i++) {
                System.out.println(values[i]);
            }

        }
    }