Содержание
- 2. Зачем нужен BigDecimal? public class BigDecimalDemo { public static void main(String[] args) { double A =
- 3. Класс BigDecimal public class BigDecimal extends Number implements Comparable { private volatile BigInteger intVal; private int
- 4. Класс BigDecimal public class BigDecimal extends Number implements Comparable { private transient int precision; public int
- 5. Хранение BigDecimal unscaledValue × 10(-scale) 2.00 = 200 × 10-2 unscaledValue: 200 scale: 2 precision: 3
- 6. Десятичный порядок, мантисса и разрядность public class ScaleValuePrecisionDemo { public static void main(String[] args) { BigDecimal
- 7. “Изменение” десятичного порядка public class SetScaleDemo { public static void main(String[] args) { BigDecimal big =
- 8. “Изменение” десятичного порядка Big decimal: 200 Unscaled value: 200 Scale: 0 Precision: 3 Big decimal: 200.00
- 9. Неизменность BigDecimal public class ImmutableDemo { public static void main(String[] args) { BigDecimal initial = new
- 10. Проверка на равенство
- 11. Проверка на равенство public class BigDecimal extends Number implements Comparable { public boolean equals(Object x) {
- 12. Проверка на равенство public class EqualsDemo { public static void main(String[] args) { BigDecimal bigA =
- 13. Использование проверки на равенство public class HashSetDemo { public static void main(String[] args) { Set set
- 14. Сравнение
- 15. Сравнение public class BigDecimal extends Number implements Comparable { public int compareTo(BigDecimal val) { if (scale
- 16. Сравнение public class CompareDemo { public static void main(String[] args) { BigDecimal bigA = new BigDecimal("2.00");
- 17. Использование сравнения public class TreeSetDemo { public static void main(String[] args) { Set set = new
- 18. Использование сравнения public class TreeSetCompareDemo { public static void main(String[] args) { Set set = new
- 19. Получение BigDecimal
- 20. Конструкторы BigDecimal public class BigDecimal extends Number implements Comparable { public BigDecimal(char[] in, int offset, int
- 21. Конструктор принимающий double public class NoDoubleConstructorDemo { public static void main(String[] args) { System.out.println(new BigDecimal(0.5)); System.out.println(new
- 22. Конструктор принимающий String public class YesStringConstructorDemo { public static void main(String[] args) { System.out.println(new BigDecimal("0.5")); System.out.println(new
- 23. Кеш экземпляров BigDecimal public class BigDecimal extends Number implements Comparable { private static final BigDecimal zeroThroughTen[]
- 24. Статические фабрики BigDecimal public class BigDecimal extends Number implements Comparable { public static BigDecimal valueOf(long unscaledVal,
- 25. Кеширование целых чисел 0 - 10 public class CachingDemo { public static void main(String[] args) {
- 26. Кеширование нулей public class CachingZeroDemo { public static void main(String[] args) { BigDecimal i = new
- 27. Точные арифметические операции
- 28. Точные арифметические операции public class BigDecimal extends Number implements Comparable { public BigDecimal add(BigDecimal augend) public
- 29. Предпочтительный порядок
- 30. Точные арифметические операции public class PreciseArithmeticDemo { public static void main(String[] args) { BigDecimal a =
- 31. Точное деление public class PreciseDivisionDemo { public static void main(String[] args) { BigDecimal a = new
- 32. Точное “изменение” десятичного порядка public class ScaleDemo { public static void main(String[] args) { BigDecimal a
- 33. Арифметические операции c контекстом
- 34. Класс MathContext public final class MathContext implements Serializable { final int precision; final RoundingMode roundingMode; public
- 35. Перечисление RoundingMode public enum RoundingMode { UP(BigDecimal.ROUND_UP), DOWN(BigDecimal.ROUND_DOWN), CEILING(BigDecimal.ROUND_CEILING), FLOOR(BigDecimal.ROUND_FLOOR), HALF_UP(BigDecimal.ROUND_HALF_UP), HALF_DOWN(BigDecimal.ROUND_HALF_DOWN), HALF_EVEN(BigDecimal.ROUND_HALF_EVEN), UNNECESSARY(BigDecimal.ROUND_UNNECESSARY); final int
- 36. Перечисление RoundingMode
- 37. Перечисление RoundingMode
- 38. Арифметические операции c контекстом public class BigDecimal extends Number implements Comparable { public BigDecimal add(BigDecimal augend,
- 39. Арифметические операции c контекстом public class ContextArithmeticDemo { public static void main(String[] args) { BigDecimal a
- 40. “Старые” арифметические операции
- 41. “Старые” арифметические операции public class BigDecimal extends Number implements Comparable { public final static int ROUND_UP
- 42. “Старые” арифметические операции public class OldDivideDemo { public static void main(String[] args) { BigDecimal a =
- 43. “Старые” арифметические операции public class OldSetScaleDemo { public static void main(String[] args) { BigDecimal a =
- 44. Преобразования к другим типам
- 45. Преобразования к другим типам public abstract class Number implements java.io.Serializable { public abstract int intValue(); public
- 46. Преобразования к BigInteger public class BigDecimal extends Number implements Comparable { public BigInteger toBigInteger() { return
- 47. Преобразования к BigInteger public class ToBigIntegerDemo { public static void main(String[] args) { BigDecimal decA =
- 48. Преобразования к примитивным типам public class BigDecimal extends Number implements Comparable { public float floatValue(){ if
- 49. Преобразования к числам с плавающей точкой public class ToDoubleDemo { public static void main(String[] args) {
- 51. Скачать презентацию