Preview:
import java.util.*;

public class Main {

  public static void main(String[] args) {
    // Write your code here

    int[] arr = {1,2,7,4,5};

    boolean ans = sorted(arr, 0);

    System.out.print(ans);

  }

  public static boolean sorted(int[] arr,int index) {
    if(index == arr.length-1){
      return true;
    }

    return arr[index]<arr[index+1] && sorted(arr, index+1);

  }
}
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter