Hello,

I started to learn Java this week and I wrote a code that gets a number (n) and creat an array[n][] with X inside that made out of '1' and '0':
For exemple the code recives 5 and creates
Java Code:
10001
0101
001
0101
10001
(after the second '1' there are no '0', part of the assignment)

I am sure that there are better ways to write this code and i would to see them.
my code:
Java Code:
public static void main(String[] args){
		int n = Integer.parseInt(args[0]);
		int [][] arr = new int[n][];
		for (int x = 0,z=0;x<n;x++){
			arr [x]= new int [n-z];
			for(int y = 0;y<n-z;y++){
				if(y==z || y==n-z-1)
					arr[x][y]=1;
				else
					arr[x][y]=0;
				System.out.print(arr[x][y]);
			}
			System.out.print("\n");
			if (n/2>x)
				z++;
			else
				z--;
		}
		System.out.print(Arrays.deepToString(arr));
	}
Thank you.