Howdy. 

import java.util.Scanner;
// import java.util.Arrays; 

public class Arrays {
  public static void main(String[] args) {
    int[] numbers = new int[0]; 
    Scanner s = new Scanner(System.in); 
    System.out.print("Number: "); 
    String line = s.nextLine(); 
    while( ! line.equals("bye") ) {
      int n = Integer.parseInt( line ); 
      numbers = /*java.util.*/Arrays.copyOf(numbers, numbers.length + 1);
      numbers[numbers.length - 1] = n; 
      System.out.println( java.util.Arrays.toString( numbers ) ); 
      System.out.print("Number: "); 
      line = s.nextLine(); 
    }
    java.util.Arrays.sort( numbers ); 
    System.out.println( java.util.Arrays.toString( numbers ) );     
  }
  public static int[] copyOf(int[] a, int size) {
    int[] answer = new int[size]; 
    for (int i = 0; i < a.length; i++) {      
      answer[i] = a[i]; 
      System.out.println( "moving: " + java.util.Arrays.toString( answer ) ); 
    }
    return answer;  
  }
}

Now 

Welcome to DrJava.  Working directory is C:\Users\dgerman\Desktop
> int[] n = new int[6]
> n
{ 0, 0, 0, 0, 0, 0 }
> int[][] a = new int[3][3];
> a
{ { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } }
> a[2] = 1
Static Error: Bad types in assignment: from int to int[]
> a[2][1] = 1
1
> a
{ { 0, 0, 0 }, { 0, 0, 0 }, { 0, 1, 0 } }
> a[0][2] = 2
2
> a
{ { 0, 0, 2 }, { 0, 0, 0 }, { 0, 1, 0 } }
> a[1][0] = 3;
> a
{ { 0, 0, 2 }, { 3, 0, 0 }, { 0, 1, 0 } }
> a[0][0] = 4;
> a
{ { 4, 0, 2 }, { 3, 0, 0 }, { 0, 1, 0 } }


Program

import java.util.Arrays; 

public class Derek {
  public static void main(String[] args) {
    int size = Integer.parseInt(args[0]); 
    int[][] a = new int[size][size];
    Derek.show(a);   
    int row = a.length - 1; 
    int col = a[row].length / 2;
    int number = 1;
    while (number <= size * size) {
      a[row][col] = number; 
      Derek.show( a ); 
      number = number + 1; 
      int i = (row + 1) % size; 
      int j = (col + 1) % size; 
      if (a[i][j] == 0) {
        row = i; 
        col = j;
      } else {
        row = row - 1;  
      }
    }
  }
  public static void show(int[][] a) {
    for (int[] row : a) 
      System.out.println( Arrays.toString( row ) );   
    System.out.println("-----------------"); 
  }
}

Here's a typical run:


> run Derek 3
[0, 0, 0]
[0, 0, 0]
[0, 0, 0]
-----------------
[0, 0, 0]
[0, 0, 0]
[0, 1, 0]
-----------------
[0, 0, 2]
[0, 0, 0]
[0, 1, 0]
-----------------
[0, 0, 2]
[3, 0, 0]
[0, 1, 0]
-----------------
[4, 0, 2]
[3, 0, 0]
[0, 1, 0]
-----------------
[4, 0, 2]
[3, 5, 0]
[0, 1, 0]
-----------------
[4, 0, 2]
[3, 5, 0]
[0, 1, 6]
-----------------
[4, 0, 2]
[3, 5, 7]
[0, 1, 6]
-----------------
[4, 0, 2]
[3, 5, 7]
[8, 1, 6]
-----------------
[4, 9, 2]
[3, 5, 7]
[8, 1, 6]
-----------------


Here's another:

> run Derek 5
[0, 0, 0, 0, 0]
[0, 0, 0, 0, 0]
[0, 0, 0, 0, 0]
[0, 0, 0, 0, 0]
[0, 0, 0, 0, 0]
-----------------
[0, 0, 0, 0, 0]
[0, 0, 0, 0, 0]
[0, 0, 0, 0, 0]
[0, 0, 0, 0, 0]
[0, 0, 1, 0, 0]
-----------------
[0, 0, 0, 2, 0]
[0, 0, 0, 0, 0]
[0, 0, 0, 0, 0]
[0, 0, 0, 0, 0]
[0, 0, 1, 0, 0]
-----------------
[0, 0, 0, 2, 0]
[0, 0, 0, 0, 3]
[0, 0, 0, 0, 0]
[0, 0, 0, 0, 0]
[0, 0, 1, 0, 0]
-----------------
[0, 0, 0, 2, 0]
[0, 0, 0, 0, 3]
[4, 0, 0, 0, 0]
[0, 0, 0, 0, 0]
[0, 0, 1, 0, 0]
-----------------
[0, 0, 0, 2, 0]
[0, 0, 0, 0, 3]
[4, 0, 0, 0, 0]
[0, 5, 0, 0, 0]
[0, 0, 1, 0, 0]
-----------------
[0, 0, 0, 2, 0]
[0, 0, 0, 0, 3]
[4, 6, 0, 0, 0]
[0, 5, 0, 0, 0]
[0, 0, 1, 0, 0]
-----------------
[0, 0, 0, 2, 0]
[0, 0, 0, 0, 3]
[4, 6, 0, 0, 0]
[0, 5, 7, 0, 0]
[0, 0, 1, 0, 0]
-----------------
[0, 0, 0, 2, 0]
[0, 0, 0, 0, 3]
[4, 6, 0, 0, 0]
[0, 5, 7, 0, 0]
[0, 0, 1, 8, 0]
-----------------
[0, 0, 0, 2, 9]
[0, 0, 0, 0, 3]
[4, 6, 0, 0, 0]
[0, 5, 7, 0, 0]
[0, 0, 1, 8, 0]
-----------------
[0, 0, 0, 2, 9]
[10, 0, 0, 0, 3]
[4, 6, 0, 0, 0]
[0, 5, 7, 0, 0]
[0, 0, 1, 8, 0]
-----------------
[11, 0, 0, 2, 9]
[10, 0, 0, 0, 3]
[4, 6, 0, 0, 0]
[0, 5, 7, 0, 0]
[0, 0, 1, 8, 0]
-----------------
[11, 0, 0, 2, 9]
[10, 12, 0, 0, 3]
[4, 6, 0, 0, 0]
[0, 5, 7, 0, 0]
[0, 0, 1, 8, 0]
-----------------
[11, 0, 0, 2, 9]
[10, 12, 0, 0, 3]
[4, 6, 13, 0, 0]
[0, 5, 7, 0, 0]
[0, 0, 1, 8, 0]
-----------------
[11, 0, 0, 2, 9]
[10, 12, 0, 0, 3]
[4, 6, 13, 0, 0]
[0, 5, 7, 14, 0]
[0, 0, 1, 8, 0]
-----------------
[11, 0, 0, 2, 9]
[10, 12, 0, 0, 3]
[4, 6, 13, 0, 0]
[0, 5, 7, 14, 0]
[0, 0, 1, 8, 15]
-----------------
[11, 0, 0, 2, 9]
[10, 12, 0, 0, 3]
[4, 6, 13, 0, 0]
[0, 5, 7, 14, 16]
[0, 0, 1, 8, 15]
-----------------
[11, 0, 0, 2, 9]
[10, 12, 0, 0, 3]
[4, 6, 13, 0, 0]
[0, 5, 7, 14, 16]
[17, 0, 1, 8, 15]
-----------------
[11, 18, 0, 2, 9]
[10, 12, 0, 0, 3]
[4, 6, 13, 0, 0]
[0, 5, 7, 14, 16]
[17, 0, 1, 8, 15]
-----------------
[11, 18, 0, 2, 9]
[10, 12, 19, 0, 3]
[4, 6, 13, 0, 0]
[0, 5, 7, 14, 16]
[17, 0, 1, 8, 15]
-----------------
[11, 18, 0, 2, 9]
[10, 12, 19, 0, 3]
[4, 6, 13, 20, 0]
[0, 5, 7, 14, 16]
[17, 0, 1, 8, 15]
-----------------
[11, 18, 0, 2, 9]
[10, 12, 19, 21, 3]
[4, 6, 13, 20, 0]
[0, 5, 7, 14, 16]
[17, 0, 1, 8, 15]
-----------------
[11, 18, 0, 2, 9]
[10, 12, 19, 21, 3]
[4, 6, 13, 20, 22]
[0, 5, 7, 14, 16]
[17, 0, 1, 8, 15]
-----------------
[11, 18, 0, 2, 9]
[10, 12, 19, 21, 3]
[4, 6, 13, 20, 22]
[23, 5, 7, 14, 16]
[17, 0, 1, 8, 15]
-----------------
[11, 18, 0, 2, 9]
[10, 12, 19, 21, 3]
[4, 6, 13, 20, 22]
[23, 5, 7, 14, 16]
[17, 24, 1, 8, 15]
-----------------
[11, 18, 25, 2, 9]
[10, 12, 19, 21, 3]
[4, 6, 13, 20, 22]
[23, 5, 7, 14, 16]
[17, 24, 1, 8, 15]
-----------------


You can improve Derek.show to format numbers in columns instead. 

--