/home/caleb/ASDV-Java/Assignments/lab16_arrays2_CalebFontenot/src/main/java/com/calebfontenot/lab16_arrays2_calebfontenot/ArraysAndMethods.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 com.calebfontenot.lab16_arrays2_calebfontenot;

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

        public static void printArray(int[] arrayInput)
        {
            for (int i : arrayInput) {
                System.out.print(i + " ");
            }
            System.out.println();
        }

        public static void printArray(char[] arrayInput)
        {
            for (int i : arrayInput) {
                System.out.print((char) i + " ");
            }
            System.out.println();
        }

        public static void printArray(double[] arrayInput)
        {
            for (double i : arrayInput) {
                System.out.print(i + " ");
            }
            System.out.println();
        }

        public static int[] reverse(int[] arrayToReverse)
        {
            int arrayResult[] = new int[arrayToReverse.length];
            int j = (arrayToReverse.length - 1);
            for (int i = 0; i <= arrayToReverse.length - 1; i++) {
                arrayResult[i] = arrayToReverse[j];
                j--;
            }
            return arrayResult;
        }

        public static int linearSearch(int list[], int key)
        {
            int indexFound = -1;
            for (int i = 0; i < list.length; ++i) {
                if (list[i] == key) {
                    indexFound = i;
                }
            }
            return indexFound;
        }

        public static void main(String[] args)
        {
            int[] array = {1, 2, 3, 4, 5};
            printArray(array);
            printArray(new int[]{3, 1, 2, 6, 4});
            printArray(reverse(array));

            System.out.println(linearSearch(array, 5) != 1
                    ? "found at index " + Integer.toString(linearSearch(array, 5))
                    : "not found at index " + Integer.toString(linearSearch(array, 5))
            );
            double[] doubles = {6.0, 4.4, 1.9, 2.9, 3.4, 3.5};
            // Use the built-in sort method to sort the double.
            java.util.Arrays.sort(doubles);

            char[] chars = {'a', 'A', '4', 'F', 'D', 'P',};
            //Sort again
            java.util.Arrays.sort(chars);
            // Now print the sorted arrays.
            printArray(doubles);
            printArray(chars);
        }
    }