Preview:
	public static void main(String[] args) {
System.out.println(deleteNth(new int[] {1,1,1,3,3,3,3,7,7,7,7,2,2,2}, 3));
	}//end main

	
	
	public static int[] deleteNth(int[] elements, int maxOccurrences) {
		boolean check = false;
		int checkListe[];
		int count;
		for (int i = 0; i < elements.length; i++) {
			checkListe = new int [i+1];
			count = 0;
			
			for (int k = 0; k < elements.length; k++) {
				for (int c = 0; c < checkListe.length; c++) {
				if (elements[i] != checkListe[c]) check = true; else check = false;
				}//end for c
				if ( check && elements[i] == elements[k]) count++;

			}//end for k
			if (count > maxOccurrences) {
				elements[i] = 0;
			}//end if
			checkListe[i] = elements[i];			
			
		}//end for i
		
		//011133702211103330777222

		//11133700222
		//11103330777222

	
		/*
		for (int r = 0; r < elements.length; r++) {
				if (elements[r] == 0) {
					
					for (int e = r+1; e < elements.length; e++ ) {
						if (e == 0) e++;
						elements[e-1] = elements[e];
						elements[e] = 0;
					}//end for e
				}//end if
			
		}//end for r
		*/
		
		for (int d = 0; d < elements.length; d++) System.out.print(elements[d]);
		System.out.println();
		
		//Code here ;)
		return elements;
	}
	
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter