int[] removeOddNumbers(int[] arr) {
List<Integer> output = new ArrayList<Integer>();
for (int arrayElement : arr) {
if (arrayElement % 2 == 0 && arrayElement != 0) {
output.add(arrayElement);
}
}
return output.stream()
.mapToInt(i -> i)
.toArray();
}
nie piszę w Javie, na REPL-u działa