How to automate if possible
<p>I am trying to print out all my elements of the array and add themselves to their index as I already figured. I don't know how to automate it. It works, but it can be better.</p>

<pre><code>public class homeworkArrays 
{

    public static void main(String[] args) 
    {
        int[] myArray = {6, 7, 2, 1, 10, 34};
        int blank = addByIndex(myArray);
    }

    public static int addByIndex(int[] myArray) 
    {
        for(int i = 0; i &lt; myArray.length; i++)   
        {   
            System.out.println(i + " - " + myArray[i]); 

        }

            myArray[0] = myArray[0] + myArray[0];
            System.out.println("0 is now " + myArray[0]);
            myArray[1] = myArray[1] + myArray[1];
            System.out.println("1 is now " + myArray[1]);
            myArray[2] = myArray[2] + myArray[2];
            System.out.println("2 is now " + myArray[2]);
            myArray[3] = myArray[3] + myArray[3];
            System.out.println("3 is now " + myArray[3]);
            myArray[4] = myArray[4] + myArray[4];
            System.out.println("4 is now " + myArray[4]);
            myArray[5] = myArray[5] + myArray[5];
            System.out.println("5 is now " + myArray[5]);


    int i = 0;
    return myArray[i];
    }
}
</code></pre>
