// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
import java.util.regex.Pattern;

public class MaxValueStringSimple {
    public static int findMaxValue(String[] strings) {
        int maxValue = 0;
        for (int i = 0; i < strings.length; i++) {
            int value;
            if (Pattern.matches("^\\d+$", strings[i])) {
                value = Integer.parseInt(strings[i]);
            } else {
                value = strings[i].length();
            }
            if(value > maxValue) {
                maxValue = value;
            }
        }
        return maxValue;
    }
    public static void main(String[] args) {
        String[] inputStrings = { "alic3", "bob", "3", "4", "00000" };
        int maxStringValue = findMaxValue(inputStrings);
        System.out.println("Maximum Value String in an Array : " + maxStringValue);
    }
}
