Here you can find the source of isMoney(String money)
public static boolean isMoney(String money)
//package com.java2s; //License from project: Apache License public class Main { public static boolean isMoney(String money) { if (!isNumber(money)) { return false; }// w w w.j av a2 s . c o m if (money.equals("0")) { return false; } for (int i = 0; i < money.length(); i++) { char ch = money.charAt(i); if (i == 0) { if (ch == '.') { return false; } if (ch == '0') { char ch1 = money.charAt(i + 1); if (ch1 != '.') { return false; } } } if (!isDigital(ch)) { return false; } } try { double d = Double.parseDouble(money); if (d < 0.01) { return false; } } catch (Exception e) { return false; } if (money.contains(".")) { int start = money.indexOf(".") + 1; String suffix = money.substring(start, money.length()); if (suffix.length() > 2) { return false; } } return true; } public static boolean isNumber(String str) { try { Double.parseDouble(str); return true; } catch (Throwable t) { return false; } } public static boolean isDigital(char c) { if (c == '1' || c == '2' || c == '3' || c == '4' || c == '5' || c == '6' || c == '7' || c == '8' || c == '9' || c == '0' || c == '.') { return true; } return false; } }