public static void main(String[]a) 
	{
		System.out.println("is Diag([1,1],[1,1])=" + isDiag(new int[]{1,1}, new int[]{1,1}));
		System.out.println("is Diag([1,2],[2,1])=" + isDiag(new int[]{1,2}, new int[]{2,1}));
		System.out.println("is Diag([2,4],[4,2])=" + isDiag(new int[]{2,4}, new int[]{4,2}));
		System.out.println("is Diag([3,4],[4,5])=" + isDiag(new int[]{3,4}, new int[]{4,5}));
		System.out.println("is Diag([3,4],[5,6])=" + isDiag(new int[]{3,4}, new int[]{5,6}));
		System.out.println("is Diag([3,4],[6,8])=" + isDiag(new int[]{3,4}, new int[]{6,8}));
		System.out.println("is Diag([3,4],[1,3])=" + isDiag(new int[]{3,4}, new int[]{1,3}));
		
		System.out.println("-----------------------");
		
		System.out.println("is attackable([1,1],[1,6])=" + attackable(new int[]{1,1}, new int[]{1,6}));
		System.out.println("is attackable([4,2],[4,1])=" + attackable(new int[]{4,2}, new int[]{4,1}));
		System.out.println("is attackable([2,4],[4,2])=" + attackable(new int[]{2,4}, new int[]{4,2}));
		System.out.println("is attackable([3,4],[4,5])=" + attackable(new int[]{3,4}, new int[]{4,5}));
		System.out.println("is attackable([3,4],[5,6])=" + attackable(new int[]{3,4}, new int[]{5,6}));
		System.out.println("is attackable([3,4],[6,8])=" + attackable(new int[]{3,4}, new int[]{6,8}));
		System.out.println("is attackable([3,4],[1,3])=" + attackable(new int[]{3,4}, new int[]{1,3}));

		System.out.println("-----------------------");

		List<Integer[]> queens = new ArrayList<Integer[]>(8);
		int[] rows = new int[max];
		int[] cols = new int[max];
		for (int i = 0; i < max; i++) {
			rows[i] = i+1;
			cols[i] = i+1;
		}
		
		int row = 1;
		int col = 1 + rand.nextInt(max);
		System.out.println("Start with new queen " + row + "," + col);
		queens.add( new Integer[]{row, col} );
		// take from rows, cols
		rows[row-1] = 0;
		cols[col-1] = 0;
		
		for (int i = 0; i < max -1; i++)
		{
			boolean found = false;
			row++;
			while (!found)
			{
				do {
					col = 1 + rand.nextInt(max);
				} while (cols[col-1] == 0);

				int[] queen = new int[]{row, col};
				found = true;
				for (Integer[] q : queens) 
				{
					int[] position = new int[]{q[0], q[1]};
					if (attackable(position, queen)) {
						found = false;
						break;
					}
				}
				
				if (found) {
					queens.add(new Integer[]{row, col});					
					rows[row-1] = 0;
					cols[col-1] = 0;
				}
			}
		}
		
		for (Integer[] q : queens) {
			System.out.println("Found queen at position " + q[0] +","+q[1]);			
		}
	}