|
|
|
@@ -112,11 +112,11 @@ public class PriceUtilV2 { |
|
|
|
// 每次获取到最后一个数 |
|
|
|
numUnit = (int) (number % 10); |
|
|
|
if (numUnit > 0) { |
|
|
|
if ((numIndex == 9) && (zeroSize >= 3)) { |
|
|
|
sb.insert(0, CN_UPPER_MONETRAY_UNIT[6]); |
|
|
|
if ((numIndex == 8) && (zeroSize >= 3)) { |
|
|
|
sb.insert(0, CN_UPPER_MONETRAY_UNIT[7]); |
|
|
|
} |
|
|
|
if ((numIndex == 13) && (zeroSize >= 3)) { |
|
|
|
sb.insert(0, CN_UPPER_MONETRAY_UNIT[10]); |
|
|
|
if ((numIndex == 12) && (zeroSize >= 3)) { |
|
|
|
sb.insert(0, CN_UPPER_MONETRAY_UNIT[11]); |
|
|
|
} |
|
|
|
sb.insert(0, CN_UPPER_MONETRAY_UNIT[numIndex]); |
|
|
|
sb.insert(0, CN_UPPER_NUMBER[numUnit]); |
|
|
|
@@ -127,11 +127,11 @@ public class PriceUtilV2 { |
|
|
|
if (!(getZero)) { |
|
|
|
sb.insert(0, CN_UPPER_NUMBER[numUnit]); |
|
|
|
} |
|
|
|
if (numIndex == 2) { |
|
|
|
if (numIndex == 3) { |
|
|
|
if (number > 0) { |
|
|
|
sb.insert(0, CN_UPPER_MONETRAY_UNIT[numIndex]); |
|
|
|
} |
|
|
|
} else if (((numIndex - 2) % 4 == 0) && (number % 1000 > 0)) { |
|
|
|
} else if (((numIndex - 3) % 5 == 0) && (number % 1000 > 0)) { |
|
|
|
sb.insert(0, CN_UPPER_MONETRAY_UNIT[numIndex]); |
|
|
|
} |
|
|
|
getZero = true; |
|
|
|
@@ -154,7 +154,7 @@ public class PriceUtilV2 { |
|
|
|
public static void main(String[] args) { |
|
|
|
//BigDecimal numberOfMoney = new BigDecimal(432342341231.906); |
|
|
|
//BigDecimal numberOfMoney = new BigDecimal(1500.100); |
|
|
|
BigDecimal numberOfMoney = new BigDecimal(20000.000); |
|
|
|
BigDecimal numberOfMoney = new BigDecimal(22200000020.109); |
|
|
|
System.out.println(numberOfMoney.toString()); |
|
|
|
System.out.println(number2CNMontrayUnit(numberOfMoney)); |
|
|
|
} |