check if a string represtns a decimal number or not code example
Example: check if string is decimal java
Scanner in = new Scanner(System.in);
String ip1 = in.nextLine();
if( ip1.matches("^\\d+\\.\\d+") )
System.out.println(ip1+"----is a decimal number");
else
System.out.println(ip1+"----is a not decimal number");