Your code would work but it would print out all of elements in a verticle line, i.e.:
4
5
6
...

You would probably want to do this, to get them all into a single row.
Code:
public static void printArray(int[] a) 
{
     for(int i = 0; i <a.length; i++) 
     {
           System.out.print(a[i] + " ");    // Doesn't leave the line, only adds a space for each
...