the array is filled with random numbers from -10 to 5. It is necessary to display the sum of the first and last positive. Java
int[] array = new int[30]; int x = 0; int counter = 0; for (int i = 0; i < array.length; i++) { array[i] = (int) (Math.random() * 16) - 10; if (array[i] > 0) { System.out.println(array[i]); } } At the moment, I was able to fill in random numbers and output positive all. But as it came to finding the first and the last, I was at a dead end. Please help in finding the first and last positive. Zero can be considered as positive.