I have to print this in the console:
9 7 5 3 1
7 5 3 1
5 3 1
3 1
1
My current code is:
  String seq = "9 7 5 3 1";
  Scanner nums = new Scanner(seq);
  int count = 5;
  while (count > 1){
  int firstNum = nums.nextInt();
  int secNum = nums.nextInt();
     if(firstNum > secNum ){
        //I'm trying to remove the first number in each iteration of the sequence.
        seq = seq.remove(firstNum);
        count --;
        System.out.println(seq);
     }
 }
How would I remove the first number each time? I don't want to write a bunch of loops for each condition.
 
     
     
     
     
    