Task: Create an array of 4 random numbers. To display them on the screen, and from the new line to display a message about what kind of sequence it is (increasing, decreasing or none).
Here is my code:
public class four { public static void main(String[] args) { int[] mas = new int[4]; for (int i = 0; i < mas.length; i++) { Random ran = new Random(); mas[i] = ran.nextInt(90) + 10; System.out.print(mas[i] + " "); } System.out.println(" "); if (mas[0] < mas[1] & mas[1] < mas[2] & mas[2] < mas[3]) { System.out.println("Последовательность строго возрастающая"); } else if (mas[0] > mas[1] & mas[1] > mas[2] & mas[2] > mas[3]) { System.out.println("Последовательность строго убывающая"); } else System.out.println("Другая последовательность"); } } I would like to know whether it is possible to do this task differently. For example, no longer from 4 numbers, but let's say 50 or 100.