I have tried with multiple test inputs and seem to get the correct result. any help would be greatly appreciated. thank you.
package com.codegym.task.task30.task3010;
/*
Smallest possible radix
*/
public class Solution {
public static void main(String[] args) {
try{
String s=args[0];
int max=0;
try{
int i=Integer.parseInt(s);
if (i<=1) System.out.println("2");
else if (i>=9) System.out.println("10");
else System.out.println(i+1);
}catch (NumberFormatException e){
s=s.toUpperCase();
byte[] arr=s.getBytes();
for(int j=0;j<arr.length;j++){
if((int)arr[j]<48||(int)arr[j]>57&&(int)arr[j]<65||(int)arr[j]>90){
System.out.println("Invalid");
return;}}
for(int k=0;k< arr.length;k++){
if((int)arr[k]>max)max=(int)arr[k];
}
System.out.println(max-54);
}
}catch (Exception e){
}}
}