fork download
  1. import java.util.*;
  2. import java.util.stream.*;
  3. class Ideone {
  4. public static void main (String[] args) {
  5. int[] sequence = {1, 3, 2, 4, 3, 5, 4, 6, 1, 3};
  6. List<Integer> list = new ArrayList<>();
  7. IntStream.of(sequence).forEach(list::add);
  8. int index = list.subList(1, list.size()).indexOf(sequence[0]) + 1;
  9. System.out.println(index);
  10.  
  11. }
  12. }
Success #stdin #stdout 0.09s 48316KB
stdin
Standard input is empty
stdout
8