//TestStuff20170124.java


public class TestStuff20170124
{
    public static void main(String[] args)
    {
        int[] intArray = new int[6]; //An int array with nothing in it
        for (int i=0; i<6; i++)      //Put some values into the array
            intArray[i] = 2 * i;
        for (int i=0; i<6; i++)      //Show that they're in there
            System.out.print(intArray[i] + " ");
        System.out.println();
        for (int i=0; i<intArray.length; i++) //Another way to them
            System.out.print(intArray[i] + " ");
        System.out.println();
        for (int value : intArray)   //And yet one more way to show them
            System.out.print(value + " ");
        System.out.println();

        //Initialize an array at the time of declaration, and then
        //using a loop to "process" the values in some way 
        System.out.println("----------");
        String[] stringArray = {"one", "two", "three", "four", "five"};
        for (String s : stringArray)
            System.out.println(s.toUpperCase()); 

        if (args.length != 0)
        {
            for (String s : args)
                 System.out.println(s);
            double sum = 0;
            for (String s : args)
                 sum += Double.parseDouble(s);
            System.out.println(sum);
            /*
            */
        }

        System.out.println("----------");
        int[][] twoDim1 = new int[2][3];
        for (int row=0; row<2; row++)
            for (int col=0; col<3; col++)
                twoDim1[row][col] = row + col;
        for (int row=0; row<2; row++)
        {
            for (int col=0; col<3; col++)
                System.out.print(twoDim1[row][col] + " ");
            System.out.println();
        }

        System.out.println("----------");
        int[][] twoDim2 = 
            {
                {1, 2, 3},
                {4, 5, 6, 7},
                {8, 9}
            };
        for (int row=0; row<twoDim2.length; row++)
        {
            for (int col=0; col<twoDim2[row].length; col++)
                System.out.print(twoDim2[row][col] + " ");
            System.out.println();
        }
    }
}
