I was asked to print the integers in the given input string. For example input:Hai 88 Hello and its output: 88 : ***I got the correct output for the below code. Is there any other way that could solve the problem?***         
        
*For example **input**:Hai 88 Hello **output:** 88*

        package stringint;
        import java.util.Scanner;
        public class StringInt 
        {
            public static void main(String[] args) 
            {
                Scanner scan = new Scanner(System.in);
                String name = scan.nextLine();
                name = name.replaceAll("[a-zA-Z]","@"); //replacing the 
                                                       //alphabets to "@"
                String[] array = name.split(" "); 
                for(int i = 0;i<array.length;i++)
                {
                    if(!array[i].contains("@")) 
                    {
                        System.out.println(array[i]);
                    }
                }
            }
        }