I am trying to run a loop to see if an int is sorted. however the int has to be converted from a string. here is my code.
public static void main(String[] args) {
    // TODO code application logic here
    Scanner maxVal = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
    System.out.println("enter the max value of ordered squares:");
    int max = maxVal.nextInt();
    for(int i = 0; i*i <= max; i++){
        int L = String.valueOf(i*i).length();
        String sq = String.valueOf(i*i);
        String [] digits = new String[L];
        for(int a = 0; a < L; a++){
            digits [a] = Character.toString(sq.charAt(a));
            if(L == 1){
                System.out.print(sq + "");
            }else if(Integer.parseInt(digits [a]) < Integer.parseInt(digits[a+1])){
                System.out.print(sq);
            }else{
            }
        }
    }
}
when I run it, I get an error : 
Exception in thread "main" java.lang.NumberFormatException: null
0149    at java.lang.Integer.parseInt(Integer.java:542)
    at java.lang.Integer.parseInt(Integer.java:615)
why does Integer.parseInt() not work
 
     
    