public static void main(String[] args) {
        Boolean strResult = "123.12".matches("-[0-9]+(.[0-9]+)?|[0-9]+(.[0-9]+)?");  
        if(strResult == true) {  
                    System.out.println("数字!");  
                } else {  
                    System.out.println("不是数据!");  
                }  
    }