How to remove repetition in output results in this code. : public class ValidInvalidNodes {
	public static void main(String[] args) {

		int[][] arr = { 
                { 5, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },        	 
                { 0, 5, 0, 0, 1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
				{ 0, 0, 5, 0, 0, 0, -1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
				{ 0, 0, 0, 5, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0 }, 
			    { 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, -1, -1, 0, 0, 0, -1, 0, 0 }, 
				{ 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0 },		 
                { 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0 },  
				{ 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, -1, 1, 0, 0, 0, 0 }, 
				{ 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 }, 
				{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 1, 0, 0, 0, 0 }, 
				{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 55, 0, 0, 0, 1, 0, 0, 0, 0 }, 
				{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, -1, 0, 0, 0 },  
				{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 55, 0, 0, -1, 0, 0, 0 }, 
				{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, -1, 0, 0 }, 
				{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, -1, 0 }, 
				{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, -1 }, 
				{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, -1 }, 
				{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, -1 }, 
				{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5 }, 
		};
		int position = 0;
		for (int i = 0; i < arr.length; i++) {
			for (int j = 0; j < arr[i].length; j++) {
				if (arr[i][j] == 1) {
					position = j;

					if (arr[position][j] == 5)

						System.out.print(" Valid Static Node V" + j + " \n");

				}
				if (arr[i][j] == -1) {
					position = j;

					if (arr[position][j] == 5)

						System.out.print(" InValid Static Node V" + j + " \n");
				}
				if (arr[i][j] == -1) {
					position = j;

					if (arr[position][j] == 55)

						System.out.print(" InValid Mobile Node V" + j + " \n");
				}

				if (arr[i][j] == 1) {
					position = j;

					if (arr[position][j] == 55)

						System.out.print(" Valid Mobile Node V" + j + " \n");  

				}

			}
		}
		// System.out.println("");
	}

}

Output:
 Valid Static Node V1 
 Valid Static Node V2 
 Valid Static Node V3 
 Valid Static Node V4 
 InValid Static Node V5 
 InValid Static Node V6 
 Valid Static Node V7 
 Valid Static Node V8 
 Valid Static Node V9 
 Valid Mobile Node V10 
 InValid Static Node V11 
 InValid Mobile Node V12 
 InValid Static Node V16 
 InValid Static Node V16 
 InValid Static Node V13 
 InValid Static Node V13 
 Valid Static Node V14 
 Valid Static Node V14 
 Valid Static Node V14 
 Valid Static Node V14 
 InValid Static Node V15 
 InValid Static Node V15 
 InValid Static Node V16 
 InValid Static Node V17 
 InValid Static Node V18 
 InValid Static Node V18 
 InValid Static Node V18 
