Since the input of selected ids might vary, the best way is to use List::contains in the filter's predicate:
// Get a list of ids at the beginning once and use with each iteration
List<Integer> idsList = Arrays.stream(ids).boxed().collect(Collectors.toList());
List<Person> personList myArrayOfPerson.stream() // Stream<Person>
.filter(person -> idsList.contains(person.getId())) // Stream<Person> of the given ids
.collect(Collectors.toList()); // List<Person>
This is the solution where the id is a part of the object Person and not driven by the behavior of the List which is not a good practice.
However, if you insist to get these on the certain positions in the List, then a bit different approach is required:
List<Person> personList = Arrays.stream(ids) // IntStream
.boxed() // Stream<Integer>
.map(myArrayOfPerson::get) // Stream<Person>
.collect(Collectors.toList()); // List<Person>
This is a fail-fast approach which doesn't handle the ids out of the bounds. You should know that List::get might throw an IndexOutOfBoundsException, so to avoid this, filter out the ids which doesn't fit the list size:
List<Person> personList = Arrays.stream(ids) // IntStream
.filter(id -> id > 0 && id < myArrayOfPerson.size()) // IntStream (wanted ids only)
.boxed() // Stream<Integer>
.map(myArrayOfPerson::get) // Stream<Person>
.collect(Collectors.toList()); // List<Person>
An alternative way would be to return null objects for unusual ids or log a message or handle it another way which is out of the scope of this answer.
Stream::filterin combination withStream::collectandCollectors.toList()?