Preview:
public static List<Integer> moveElementToEnd(List<Integer> array, int toMove) {	
  int i = 0;
  int j = array.size()-1;
		
  while(i < j){
			
	while( i < j && array.get(j) == toMove)
		j--;
	if(array.get(i) == toMove)
	   swap(i,j, array);
		
    i++;							
  }		
	return array;		
  }
	
public static void swap(int i, int j, List<Integer> array ){
			
  int temp = array.get(i);
  array.set(i, array.get(j));			
  array.set(j, temp);
}
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