类 NumberUtil


  • public class NumberUtil
    extends Object
    版本:
    v1.0,Date:Oct 18, 2007 9:19:50 AM
    作者:
    zhongxuchen
    • 字段详细资料

      • ONE_BIGDECIMAL

        protected final BigDecimal ONE_BIGDECIMAL
    • 方法详细资料

      • format

        public static String format​(Object target,
                                    String pattern)
        参数:
        target -
        pattern -
        返回:
      • formatCurrency

        public static String formatCurrency​(Object target,
                                            String pattern,
                                            Locale locale)
        参数:
        target -
        pattern -
        locale -
        返回:
      • parsePercent

        public static Float parsePercent​(String percent)
        参数:
        percent - :example: 90% return 0.9
        返回:
      • parseFloat

        public static Float parseFloat​(String floatStr,
                                       Integer maxIntDigits,
                                       Integer maxFractionDigits)
        参数:
        floatStr -
        maxIntDigits -
        maxFractionDigits -
        返回:
      • parseDecimal

        public static BigDecimal parseDecimal​(String decimalStr,
                                              Integer maxIntDigits,
                                              Integer maxFractionDigits)
        参数:
        decimalStr -
        maxIntDigits -
        maxFractionDigits -
        返回:
      • parseDouble

        public static Double parseDouble​(String doubleStr,
                                         Integer maxIntDigits,
                                         Integer maxFractionDigits)
        参数:
        doubleStr -
        maxIntDigits -
        maxFractionDigits -
        返回:
      • capitalMoneyToNum

        public static BigDecimal capitalMoneyToNum​(String capitalMoney)
        参数:
        capitalMoney -
        返回:
      • toCapitalMoney

        public static String toCapitalMoney​(BigDecimal money)
        参数:
        money -
        返回:
      • numberToChina

        public static String numberToChina​(int sourceInt)
        参数:
        sourceInt -
        返回:
      • getAverage

        public static BigDecimal getAverage​(BigDecimal[] bigArray)
        参数:
        bigArray -
        返回:
      • isInteger

        public static boolean isInteger​(String obj)
        参数:
        obj -
        返回:
      • isNumber

        public static boolean isNumber​(String numberStr)
        参数:
        numberStr -
        返回:
      • getRandomNum

        public static int getRandomNum​(int max)
      • getRandomNum

        public static int getRandomNum​(int start,
                                       int end)
      • randomArray

        public static Object[] randomArray​(int maxValue,
                                           int size)
        参数:
        maxValue - 随机数的最大值
        size - 随机数的个数
        返回:
      • getProbabilityIndex

        public static int getProbabilityIndex​(int[] probabilities)
        参数:
        probabilities -
        返回:
      • convertToEnglishMoney

        public static String convertToEnglishMoney​(BigDecimal value)
        参数:
        value -
        返回:
      • convertToEnglishMoney

        public static String convertToEnglishMoney​(String value)
        参数:
        value -
        返回: