Write code to check if a string is Numeric by regex
//package com.book2s; import java.util.regex.Pattern; public class Main { public static void main(String[] argv) { String str = "book2s.com"; System.out.println(isNumeric(str)); }/* w w w. j a v a 2s. c o m*/ public static boolean isNumeric(String str) { Pattern pattern = Pattern.compile("[0-9]*"); return pattern.matcher(str).matches(); } }