import java.util.*; class UseArrayLists15 // Shows constructively removing the integer before all occurrences of // an integer in an ArrayList { public static void main(String[] args) throws Exception { Scanner input = new Scanner(System.in); System.out.println("Enter some numbers (all on one line, separated by spaces):"); String line = input.nextLine(); String[] numbers = line.split(" +"); ArrayList a = new ArrayList(); for(int i=0; i b = removeBefore(a,p); System.out.println("\nThe result is "+b); } public static ArrayList removeBefore(ArrayList a,int m) // Removes the number which occurs before every occurrence of m in a, // does this costructively { ArrayList b = new ArrayList(); for(int i=0; i