public static enum Rounder.RoundingPolicy extends Enum<Rounder.RoundingPolicy>
Enum Constant and Description |
---|
CEILING
Behaves the same as
UP if the value is positive or DOWN if the value is negative. |
DOWN
Discards the digits based on decimal places and never increments the digit prior to discarded fraction.
|
FLOOR
Behaves the same as
DOWN if the value is positive or UP if the value is negative. |
HALF_DOWN
If discarded fraction is > 0.5, then behaves as
UP , otherwise, behaves as DOWN |
HALF_EVEN
If the digit to the left of the discarded fraction is odd, behaves as
HALF_UP , otherwise, behaves as HALF_DOWN |
HALF_ODD
If the digit to the left of the discarded fraction is odd, behaves as
HALF_DOWN , otherwise, behaves as HALF_UP . |
HALF_UP
If discarded fraction is ≥ 0.5, then behaves as
UP , otherwise, behaves as DOWN |
UNNECESSARY
If value is double, returns the same value.
|
UP
Discards the digits based on decimal places and always increments the digit prior to discarded fraction.
|
Modifier and Type | Method and Description |
---|---|
int |
getPolicy() |
static Rounder.RoundingPolicy |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static Rounder.RoundingPolicy[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final Rounder.RoundingPolicy UP
public static final Rounder.RoundingPolicy DOWN
public static final Rounder.RoundingPolicy CEILING
UP
if the value is positive or DOWN
if the value is negative.public static final Rounder.RoundingPolicy FLOOR
DOWN
if the value is positive or UP
if the value is negative.public static final Rounder.RoundingPolicy HALF_UP
UP
, otherwise, behaves as DOWN
public static final Rounder.RoundingPolicy HALF_DOWN
UP
, otherwise, behaves as DOWN
public static final Rounder.RoundingPolicy HALF_EVEN
HALF_UP
, otherwise, behaves as HALF_DOWN
public static final Rounder.RoundingPolicy HALF_ODD
HALF_DOWN
, otherwise, behaves as HALF_UP
.
This RoudingPolicy is only supported for double. BigDecimal & BigInteger are not supported.public static final Rounder.RoundingPolicy UNNECESSARY
ArithmeticException
is thrown.public static Rounder.RoundingPolicy[] values()
for (Rounder.RoundingPolicy c : Rounder.RoundingPolicy.values()) System.out.println(c);
public static Rounder.RoundingPolicy valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullpublic int getPolicy()
Copyright (c) 2006-2024 North Concepts Inc. All Rights Reserved.