Line 20 is not printing invalid when it should be.
And I get the "If any exception has occurred, you need to catch it and not display the stack trace." message even though I changed it to Exception and still wouldn't pass that requirement.
package com.codegym.task.task30.task3010;
/*
Smallest possible radix
*/
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.regex.Pattern;
public class Solution {
public static void main(String[] args) {
//write your code here
//args[0] is a string that contains a sequence of characters
//string length does not exceed 255 chars
if (Pattern.matches("[^A-Za-z0-9]", args[0])) System.out.println("Invalid");
else {
ArrayList<BigInteger> radix = new ArrayList<>();
int j = 2;
while (j <= 36) {
try {
new BigInteger(args[0], j);
System.out.println(j);
break;
} catch (Exception ignored){ }
++j;
}
}
}
}
/*
*/