ArrayIndexOutOfBoundsException when iterating through all the elements of an array

The array indexes in Java start from 0 and go to array.length - 1. So change the loop to for(int i=0;i<a.length;i++)


Indexes start from 0 so last index is 63. Change your for loop like this:
for(int i=0;i<a.length;i++){


See the JLS-Arrays:

If an array has n components, we say n is the length of the array; the components of the array are referenced using integer indices from 0 to n - 1, inclusive.

So you have to iterate through [0,length()-1]

for(int i=0;i<a.length;i++) {
    a[i]=i+1;  //add +1, because you want the content to be 1..64
    System.out.println(a[i]);

}