|
@@ -81,40 +81,40 @@ public class BigDecimalUtil {
|
|
|
|
|
|
}
|
|
|
|
|
|
- public static void main(String[] args) {
|
|
|
- DecimalFormat df = new DecimalFormat("#.00");
|
|
|
- DecimalFormat df2 = new DecimalFormat("#0.00");
|
|
|
- BigDecimal a = new BigDecimal(0.55);
|
|
|
- BigDecimal b = new BigDecimal(11.55);
|
|
|
- System.out.println(df.format(a));
|
|
|
- System.out.println(df2.format(a));
|
|
|
- System.out.println(df.format(b));
|
|
|
- System.out.println(df2.format(b));
|
|
|
-
|
|
|
- System.out.println("====a小于b====");
|
|
|
- System.out.println(lt(new BigDecimal(1.1), new BigDecimal(1)) == false);
|
|
|
- System.out.println(lt(new BigDecimal(1), new BigDecimal(1)) == false);
|
|
|
- System.out.println(lt(new BigDecimal(0.9), new BigDecimal(1)) == true);
|
|
|
-
|
|
|
- System.out.println("====a等于b====");
|
|
|
- System.out.println(eq(new BigDecimal(1.1), new BigDecimal(1)) == false);
|
|
|
- System.out.println(eq(new BigDecimal(1), new BigDecimal(1)) == true);
|
|
|
- System.out.println(eq(new BigDecimal(0.9), new BigDecimal(1)) == false);
|
|
|
-
|
|
|
- System.out.println("====a大于b====");
|
|
|
- System.out.println(gt(new BigDecimal(1.1), new BigDecimal(1)) == true);
|
|
|
- System.out.println(gt(new BigDecimal(1), new BigDecimal(1)) == false);
|
|
|
- System.out.println(gt(new BigDecimal(0.9), new BigDecimal(1)) == false);
|
|
|
-
|
|
|
- System.out.println("====a大于等于b====");
|
|
|
- System.out.println(ge(new BigDecimal(1.1), new BigDecimal(1)) == true);
|
|
|
- System.out.println(ge(new BigDecimal(1), new BigDecimal(1)) == true);
|
|
|
- System.out.println(ge(new BigDecimal(0.9), new BigDecimal(1)) == false);
|
|
|
-
|
|
|
- System.out.println("====a小于等于b====");
|
|
|
- System.out.println(le(new BigDecimal(1.1), new BigDecimal(1)) == false);
|
|
|
- System.out.println(le(new BigDecimal(1), new BigDecimal(1)) == true);
|
|
|
- System.out.println(le(new BigDecimal(0.9), new BigDecimal(1)) == true);
|
|
|
-
|
|
|
- }
|
|
|
+// public static void main(String[] args) {
|
|
|
+// DecimalFormat df = new DecimalFormat("#.00");
|
|
|
+// DecimalFormat df2 = new DecimalFormat("#0.00");
|
|
|
+// BigDecimal a = new BigDecimal(0.55);
|
|
|
+// BigDecimal b = new BigDecimal(11.55);
|
|
|
+// System.out.println(df.format(a));
|
|
|
+// System.out.println(df2.format(a));
|
|
|
+// System.out.println(df.format(b));
|
|
|
+// System.out.println(df2.format(b));
|
|
|
+//
|
|
|
+// System.out.println("====a小于b====");
|
|
|
+// System.out.println(lt(new BigDecimal(1.1), new BigDecimal(1)) == false);
|
|
|
+// System.out.println(lt(new BigDecimal(1), new BigDecimal(1)) == false);
|
|
|
+// System.out.println(lt(new BigDecimal(0.9), new BigDecimal(1)) == true);
|
|
|
+//
|
|
|
+// System.out.println("====a等于b====");
|
|
|
+// System.out.println(eq(new BigDecimal(1.1), new BigDecimal(1)) == false);
|
|
|
+// System.out.println(eq(new BigDecimal(1), new BigDecimal(1)) == true);
|
|
|
+// System.out.println(eq(new BigDecimal(0.9), new BigDecimal(1)) == false);
|
|
|
+//
|
|
|
+// System.out.println("====a大于b====");
|
|
|
+// System.out.println(gt(new BigDecimal(1.1), new BigDecimal(1)) == true);
|
|
|
+// System.out.println(gt(new BigDecimal(1), new BigDecimal(1)) == false);
|
|
|
+// System.out.println(gt(new BigDecimal(0.9), new BigDecimal(1)) == false);
|
|
|
+//
|
|
|
+// System.out.println("====a大于等于b====");
|
|
|
+// System.out.println(ge(new BigDecimal(1.1), new BigDecimal(1)) == true);
|
|
|
+// System.out.println(ge(new BigDecimal(1), new BigDecimal(1)) == true);
|
|
|
+// System.out.println(ge(new BigDecimal(0.9), new BigDecimal(1)) == false);
|
|
|
+//
|
|
|
+// System.out.println("====a小于等于b====");
|
|
|
+// System.out.println(le(new BigDecimal(1.1), new BigDecimal(1)) == false);
|
|
|
+// System.out.println(le(new BigDecimal(1), new BigDecimal(1)) == true);
|
|
|
+// System.out.println(le(new BigDecimal(0.9), new BigDecimal(1)) == true);
|
|
|
+//
|
|
|
+// }
|
|
|
}
|