public static void main(String[] args) {
int[] array = { 1, 2, 4, 5, 2, 5, 7, 5, 2, 8, 1 };
int[] indices = IntStream.range(0, array.length).filter(i -> array[i] == 5).toArray();
System.out.println(Arrays.toString(indices));
}
public static void main(String[] args) {
int sum = 0;
for (int i = 1; i <=100; i++) {
if(i%9 != 0 ){
sum+=i;
}
}
System.out.println("sum = " + sum);
}
public static void main(String[] args) {
int sum = IntStream.range(1, 100).filter(i -> (i%9!=0)).sum();
System.out.println("sum = " + sum);
}