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.

21 lines
587 B

7 years ago
  1. public class NumbersInString{
  2. public static void numbersInString (String input) {
  3. String[] parts = input.split("\\*\\*(?:[^0-9]+)?");
  4. int max = -1;
  5. int temp = 0;
  6. for (int i = 0;i<parts.length;i++){
  7. temp = Integer.parseInt(parts[i]);
  8. max = Math.max(temp,max);
  9. }
  10. System.out.println("Max: "+max);
  11. }
  12. public static void main(String[] args){
  13. String input;
  14. if (args.length > 0){
  15. input = args[0];
  16. }
  17. else {
  18. input = "3**1**June**NEIU**0**Move**9";
  19. }
  20. numbersInString(input);
  21. }
  22. }