Package xyz.ukrainskiys.decimal
Class Decimal
java.lang.Object
java.lang.Number
xyz.ukrainskiys.decimal.Decimal
- All Implemented Interfaces:
Serializable,Comparable<Decimal>
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionDecimal()Decimal(BigDecimal bigDecimal) new Decimal() == 0 new Decimal(BigDecimal.valueOf(666)) == 666 Decimal.of(666) == 666 Decimal.of(6.66) == 6.66 Decimal.ofKopecks(12345) == 123.45 -
Method Summary
Modifier and TypeMethodDescriptionadd(double value) add(int value) add(long value) add(BigDecimal other) intdoublefloatintintValue()booleanis(double value) booleanis(int value) booleanis(long value) booleanis(BigDecimal other) booleanDecimal.of(10).is(BigDecimal.TEN) == true Decimal.of(10.00).is(10) == truebooleanless(double value) booleanless(int value) booleanless(long value) booleanbooleanless(BigDecimal other) booleanlongbooleanmore(double value) booleanmore(int value) booleanmore(long value) booleanbooleanmore(BigDecimal other) booleanDecimal.HUNDRED.more(Decimal.TEN) == true Decimal.HUNDRED.less(Decimal.TEN) == false Decimal.HUNDRED.more(100) == falsemultiply(double value) multiply(int value) multiply(long value) multiply(BigDecimal other) static Decimalof(double value) static Decimalof(int value) static Decimalof(long value) static Decimalstatic Decimalof(BigDecimal value) static DecimalofKopecks(long kopecks) ofPercent(int percent) Decimal.of(200).ofPercent(50) == 100safeDivide(double value) safeDivide(int value) safeDivide(long value) safeDivide(String value) safeDivide(BigDecimal other) safeDivide(Decimal other) Decimal.HUNDRED.safeDivide(10) == 10 Decimal.HUNDRED.safeDivide(33) == 3.0303030303safeSetScale(int scale) Decimal.of(3.0303030303).safeSetScale(1) == 3.0 Decimal.of(3.0303030303).setScaleWithKopecks() == 3.03subtract(double value) subtract(int value) subtract(long value) subtract(BigDecimal other) toString()Methods inherited from class java.lang.Number
byteValue, shortValue
-
Constructor Details
-
Decimal
new Decimal() == 0 new Decimal(BigDecimal.valueOf(666)) == 666 Decimal.of(666) == 666 Decimal.of(6.66) == 6.66 Decimal.ofKopecks(12345) == 123.45 -
Decimal
public Decimal()
-
-
Method Details
-
of
-
of
-
of
-
of
-
of
-
ofKopecks
-
more
Decimal.HUNDRED.more(Decimal.TEN) == true Decimal.HUNDRED.less(Decimal.TEN) == false Decimal.HUNDRED.more(100) == false -
more
-
more
public boolean more(int value) -
more
public boolean more(long value) -
more
public boolean more(double value) -
more
-
less
-
less
-
less
public boolean less(int value) -
less
public boolean less(long value) -
less
public boolean less(double value) -
less
-
max
-
min
-
add
-
add
-
add
-
add
-
add
-
add
-
subtract
-
subtract
-
subtract
-
subtract
-
subtract
-
subtract
-
multiply
-
multiply
-
multiply
-
multiply
-
multiply
-
multiply
-
safeDivide
Decimal.HUNDRED.safeDivide(10) == 10 Decimal.HUNDRED.safeDivide(33) == 3.0303030303 -
safeDivide
-
safeDivide
-
safeDivide
-
safeDivide
-
safeDivide
-
ofPercent
Decimal.of(200).ofPercent(50) == 100 -
is
Decimal.of(10).is(BigDecimal.TEN) == true Decimal.of(10.00).is(10) == true -
is
-
is
public boolean is(int value) -
is
public boolean is(double value) -
is
public boolean is(long value) -
safeSetScale
Decimal.of(3.0303030303).safeSetScale(1) == 3.0 Decimal.of(3.0303030303).setScaleWithKopecks() == 3.03 -
setScaleWithKopecks
-
getBigDecimal
-
intValue
public int intValue() -
longValue
public long longValue() -
floatValue
public float floatValue()- Specified by:
floatValuein classNumber
-
doubleValue
public double doubleValue()- Specified by:
doubleValuein classNumber
-
compareTo
- Specified by:
compareToin interfaceComparable<Decimal>
-
toString
-