You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
587 B

public class NumbersInString{
public static void numbersInString (String input) {
String[] parts = input.split("\\*\\*(?:[^0-9]+)?");
int max = -1;
int temp = 0;
for (int i = 0;i<parts.length;i++){
temp = Integer.parseInt(parts[i]);
max = Math.max(temp,max);
}
System.out.println("Max: "+max);
}
public static void main(String[] args){
String input;
if (args.length > 0){
input = args[0];
}
else {
input = "3**1**June**NEIU**0**Move**9";
}
numbersInString(input);
}
}