Tagged articles
81 articles
Page 1 of 1
Java Architect Essentials
Java Architect Essentials
Apr 22, 2026 · Fundamentals

Beware of BigDecimal Pitfalls: When Precision Errors Can Cost You

This article explains why using Java's BigDecimal for high‑precision calculations requires careful constructor selection, demonstrates the hidden errors of the double‑based constructor, shows how to format and compare values, and provides a utility class with safe arithmetic methods.

ArithmeticBigDecimalJava
0 likes · 24 min read
Beware of BigDecimal Pitfalls: When Precision Errors Can Cost You
Java Web Project
Java Web Project
Mar 17, 2026 · Fundamentals

Why the String Constructor Makes BigDecimal Precise While Double Fails

This article explains how Java's BigDecimal class provides exact arithmetic for numbers beyond double's 16‑digit limit, demonstrates the pitfalls of using the double constructor with concrete examples, and guides developers through constructors, common methods, formatting, exception handling, and a utility class for high‑precision calculations.

ArithmeticBigDecimalJava
0 likes · 27 min read
Why the String Constructor Makes BigDecimal Precise While Double Fails
Java Captain
Java Captain
Feb 27, 2026 · Fundamentals

Long vs BigDecimal for Money: Ten Community Perspectives

A developer asks whether monetary amounts should be stored as Long or BigDecimal, and the article compiles ten varied community suggestions—ranging from using Long, BigDecimal, String, custom types, Protobuf, leadership directives, AI answers, frugal choices, to whimsical ideas—each with brief explanations and illustrative images.

BigDecimalData TypesJava
0 likes · 4 min read
Long vs BigDecimal for Money: Ten Community Perspectives
Java Captain
Java Captain
Feb 16, 2026 · Backend Development

Long vs BigDecimal: Choosing the Right Java Type for Money

This article compares ten community‑sourced approaches for representing monetary values in Java, explaining when a simple Long, a precise BigDecimal, a String, custom wrappers, Protobuf tricks, leadership directives, AI assistance, or even minimal integer types are appropriate, and why each choice matters.

Backend DevelopmentBigDecimalData Types
0 likes · 3 min read
Long vs BigDecimal: Choosing the Right Java Type for Money
macrozheng
macrozheng
Feb 3, 2026 · Backend Development

Long vs BigDecimal for Money: 10 Community Perspectives

The article explores the common dilemma of choosing between Long and BigDecimal for monetary values, summarizing ten distinct community suggestions ranging from using Long, BigDecimal, String, Protobuf, custom types, leadership advice, AI assistance, to minimalist integer approaches.

BigDecimalData TypesJava
0 likes · 4 min read
Long vs BigDecimal for Money: 10 Community Perspectives
Architect's Must-Have
Architect's Must-Have
Jul 25, 2025 · Backend Development

Avoid Common BigDecimal Pitfalls in Java: 4 Critical Mistakes and Fixes

This article outlines four common pitfalls when using Java's BigDecimal for high‑precision calculations—constructing from floating‑point literals, using equals for comparison, losing precision in division, and rounding issues—and provides practical solutions such as using string constructors, compareTo, specifying scale and rounding mode.

BigDecimalfloating-pointprecision
0 likes · 5 min read
Avoid Common BigDecimal Pitfalls in Java: 4 Critical Mistakes and Fixes
FunTester
FunTester
Apr 24, 2025 · Fundamentals

How to Validate Numeric Strings in Java: Multiple Approaches Explained

This article compares five Java techniques for checking whether a string represents a valid number—including manual character iteration, Integer.parseInt/Double.parseDouble, BigDecimal, regular expressions, and Apache Commons NumberUtils—showing code samples, test cases, and the pros and cons of each method.

Apache CommonsBigDecimalJava
0 likes · 16 min read
How to Validate Numeric Strings in Java: Multiple Approaches Explained
Top Architecture Tech Stack
Top Architecture Tech Stack
Mar 11, 2025 · Fundamentals

Understanding Java BigDecimal: How It Guarantees Precision

This article explains the Java BigDecimal class, its internal fields, and how its addition method scales numbers to maintain precision, illustrated with code examples and debugging insights, concluding that BigDecimal performs arithmetic using scaled long integers to avoid precision loss.

ArithmeticBigDecimalJava
0 likes · 6 min read
Understanding Java BigDecimal: How It Guarantees Precision
ITPUB
ITPUB
Mar 8, 2025 · Backend Development

Why Does 2.01 Turn Into 2.00? Avoid Double Precision Bugs in Money Calculations

The article explains how using double for monetary values can cause precision loss—turning 2.01 into 2.00—illustrates the binary representation issue, demonstrates failing code, and presents a robust solution using Java's BigDecimal with sample conversion methods and performance tests.

BigDecimalJavaMoney
0 likes · 6 min read
Why Does 2.01 Turn Into 2.00? Avoid Double Precision Bugs in Money Calculations
macrozheng
macrozheng
Feb 25, 2025 · Fundamentals

Why double Is Inaccurate and How to Use BigDecimal Correctly in Java

This article explains why double precision numbers cannot represent many decimal values exactly, how BigDecimal achieves precise arithmetic through unscaled values and scale, and the proper ways to construct BigDecimal objects to avoid precision loss in Java applications.

BigDecimalfloating-pointprecision
0 likes · 10 min read
Why double Is Inaccurate and How to Use BigDecimal Correctly in Java
Spring Full-Stack Practical Cases
Spring Full-Stack Practical Cases
Jan 10, 2025 · Backend Development

Java String Tricks: replace vs replaceAll, Integer Caching, BigDecimal Precision

This article explains the differences between replace and replaceAll, how Integer caching affects equality checks, why constructing BigDecimal with double can cause precision loss, the nuances of string concatenation, the distinction between isEmpty and isBlank, when to check for null in MyBatis mapper results, and the correct way to use indexOf in Java.

BigDecimalSpring BootString
0 likes · 13 min read
Java String Tricks: replace vs replaceAll, Integer Caching, BigDecimal Precision
IT Services Circle
IT Services Circle
Dec 10, 2024 · Fundamentals

Six Common Mistakes When Using Java BigDecimal and How to Avoid Them

This article explains six typical pitfalls when using Java's BigDecimal for precise calculations—such as initializing with floating‑point literals, neglecting scale in division, misusing equals, confusing scale with precision, ignoring immutability, and performance overhead—and provides clear code‑based solutions to each problem.

ArithmeticBigDecimalJava
0 likes · 7 min read
Six Common Mistakes When Using Java BigDecimal and How to Avoid Them
Su San Talks Tech
Su San Talks Tech
Dec 6, 2024 · Fundamentals

6 Common BigDecimal Mistakes in Java and How to Avoid Them

This article explains six typical pitfalls when using Java's BigDecimal—such as initializing with floating‑point literals, ignoring scale in division, misusing equals, misunderstanding scale, overlooking immutability, and performance costs—and provides clear code examples and best‑practice solutions to prevent precision loss and inefficiency.

ArithmeticBigDecimalJava
0 likes · 7 min read
6 Common BigDecimal Mistakes in Java and How to Avoid Them
Code Ape Tech Column
Code Ape Tech Column
Oct 25, 2024 · Fundamentals

Understanding Why BigDecimal Preserves Precision in Java

This article explains how Java's BigDecimal class maintains exact decimal precision by scaling numbers to long integers, detailing its internal fields, demonstrating addition with sample code, and analyzing the underlying add method logic to show why no precision is lost.

ArithmeticBackendBigDecimal
0 likes · 6 min read
Understanding Why BigDecimal Preserves Precision in Java
Architecture Digest
Architecture Digest
Sep 27, 2024 · Fundamentals

Comprehensive Guide to Java BigDecimal: Overview, Constructors, Common Methods, Formatting, and Pitfalls

This article provides an in‑depth introduction to Java's BigDecimal class, covering its purpose for high‑precision arithmetic, frequently used constructors, essential arithmetic and conversion methods, comparison techniques, number‑formatting examples, common exceptions during division, and a utility class that encapsulates typical operations.

ArithmeticBigDecimalJava
0 likes · 14 min read
Comprehensive Guide to Java BigDecimal: Overview, Constructors, Common Methods, Formatting, and Pitfalls
Java Architect Essentials
Java Architect Essentials
Sep 4, 2024 · Fundamentals

Understanding Java's BigDecimal: How It Guarantees Precision

This article explains why Java's BigDecimal class maintains exact precision by examining its internal fields, demonstrating usage through test code, and walking through the add method's implementation to show how values are scaled and computed as long integers before producing the final result.

ArithmeticBigDecimalJava
0 likes · 7 min read
Understanding Java's BigDecimal: How It Guarantees Precision
DaTaobao Tech
DaTaobao Tech
Aug 23, 2024 · Fundamentals

Common Java Pitfalls and Their Solutions

The article outlines frequent Java pitfalls—including BigDecimal precision loss, immutable lists from Arrays.asList, double division by zero returning Infinity, null values in switch statements, stream filters mutating original objects, and autoboxing nulls causing NullPointerExceptions—and provides clear explanations and practical fixes to enhance code reliability.

Arrays.asListAutoboxingBigDecimal
0 likes · 5 min read
Common Java Pitfalls and Their Solutions
IT Architects Alliance
IT Architects Alliance
Jul 29, 2024 · Fundamentals

Understanding Java BigDecimal: Overview, Constructors, Methods, Formatting, and Common Issues

This article explains Java's BigDecimal class, covering its purpose for high‑precision arithmetic, common constructors, essential methods such as add, subtract, multiply, divide, comparison, formatting with NumberFormat, handling of division exceptions, and provides a utility class with static arithmetic operations for accurate calculations.

ArithmeticBigDecimalException
0 likes · 15 min read
Understanding Java BigDecimal: Overview, Constructors, Methods, Formatting, and Common Issues
Architect
Architect
Jul 22, 2024 · Fundamentals

Understanding and Using Java BigDecimal for Precise Arithmetic

This article introduces Java's BigDecimal class, explains its purpose for high-precision arithmetic beyond double's limits, details constructors, common methods, formatting, comparison, and exception handling, and provides practical code examples and a utility class for accurate mathematical operations.

ArithmeticBigDecimalJava
0 likes · 15 min read
Understanding and Using Java BigDecimal for Precise Arithmetic
Top Architect
Top Architect
Jun 28, 2024 · Fundamentals

Understanding and Using Java BigDecimal for Precise Arithmetic

This article explains the purpose, constructors, common methods, formatting techniques, and exception handling of Java's BigDecimal class, providing code examples and best‑practice recommendations for performing high‑precision calculations in Java applications.

ArithmeticBigDecimalJava
0 likes · 17 min read
Understanding and Using Java BigDecimal for Precise Arithmetic
Architect's Guide
Architect's Guide
Jun 24, 2024 · Fundamentals

Comprehensive Guide to Java BigDecimal: Overview, Constructors, Methods, Formatting, and Common Pitfalls

This article explains Java's BigDecimal class, covering its purpose for high‑precision arithmetic, recommended constructors, key arithmetic methods, comparison techniques, formatting with NumberFormat, handling of division exceptions, and best‑practice tips such as using the String constructor and managing immutability.

ArithmeticBigDecimalException
0 likes · 13 min read
Comprehensive Guide to Java BigDecimal: Overview, Constructors, Methods, Formatting, and Common Pitfalls
Java Tech Enthusiast
Java Tech Enthusiast
Jun 14, 2024 · Fundamentals

Understanding and Using Java BigDecimal for Precise Calculations

Java's BigDecimal class offers arbitrary‑precision decimal arithmetic, requiring method calls like add, subtract, multiply, and divide instead of operators, and should be instantiated via String or valueOf to avoid double‑precision errors, with careful handling of scaling, rounding, formatting, and comparison for exact financial calculations.

ArithmeticBigDecimalJava
0 likes · 14 min read
Understanding and Using Java BigDecimal for Precise Calculations
Top Architect
Top Architect
Jun 8, 2024 · Backend Development

Comprehensive Guide to Java BigDecimal: Overview, Constructors, Methods, Formatting, Exceptions, and Utilities

This article provides an in‑depth tutorial on Java's BigDecimal class, covering its purpose, common constructors, essential arithmetic methods, comparison techniques, formatting with NumberFormat, handling of division exceptions, and a utility class offering precise add, subtract, multiply, divide, rounding, and comparison operations.

ArithmeticBigDecimalJava
0 likes · 16 min read
Comprehensive Guide to Java BigDecimal: Overview, Constructors, Methods, Formatting, Exceptions, and Utilities
Java Tech Enthusiast
Java Tech Enthusiast
May 13, 2024 · Backend Development

Understanding Java BigDecimal Precision Mechanism

The article explains how Java’s BigDecimal class maintains exact financial precision by storing numbers as an unscaled integer and a scale, scaling operands to a common decimal place, performing integer arithmetic—including handling differing scales—and finally reconstructing a correctly scaled result.

ArithmeticBigDecimalJava
0 likes · 7 min read
Understanding Java BigDecimal Precision Mechanism
Selected Java Interview Questions
Selected Java Interview Questions
Jan 1, 2024 · Backend Development

Comprehensive Guide to Java BigDecimal: Overview, Constructors, Common Methods, Formatting, and Exceptions

This article provides an in‑depth overview of Java's BigDecimal class, covering its purpose for high‑precision arithmetic, frequently used constructors, essential methods for arithmetic and conversion, techniques for formatting numbers, handling of common exceptions, and includes practical code examples and a utility class for precise calculations.

ArithmeticBigDecimalExceptions
0 likes · 16 min read
Comprehensive Guide to Java BigDecimal: Overview, Constructors, Common Methods, Formatting, and Exceptions
macrozheng
macrozheng
Nov 29, 2023 · Backend Development

Why BigDecimal Is the Safest Choice for Money Calculations in Java

This article explains why using Java's BigDecimal for monetary values ensures precise, immutable, and correctly rounded calculations, compares it with float, double, long, and int, and provides best‑practice code examples for constructing, computing, and formatting financial numbers.

BigDecimalJavaMonetary Calculations
0 likes · 8 min read
Why BigDecimal Is the Safest Choice for Money Calculations in Java
Rare Earth Juejin Tech Community
Rare Earth Juejin Tech Community
Nov 11, 2023 · Backend Development

Performance Comparison of List.sort() vs Stream.sorted() in Java and Optimization Techniques

The article analyzes why a Java API endpoint took eight seconds, demonstrates through benchmarks that List.sort() outperforms Stream.sorted(), shows how sorting on computed columns and using BigDecimal can drastically slow execution, and presents three practical optimizations that reduce the response time to under a second.

BigDecimalJavalist.sort
0 likes · 8 min read
Performance Comparison of List.sort() vs Stream.sorted() in Java and Optimization Techniques
Architecture Digest
Architecture Digest
Aug 18, 2023 · Backend Development

Comprehensive Guide to Java BigDecimal: Constructors, Methods, Formatting, and Common Pitfalls

This article explains Java's BigDecimal class, covering its purpose for high‑precision arithmetic, the most frequently used constructors, essential instance methods, comparison techniques, formatting with NumberFormat, handling of division exceptions, and a utility class that wraps common operations, all illustrated with concrete code examples.

ArithmeticBigDecimalJava
0 likes · 15 min read
Comprehensive Guide to Java BigDecimal: Constructors, Methods, Formatting, and Common Pitfalls
Architecture Digest
Architecture Digest
May 10, 2023 · Fundamentals

Comprehensive Guide to Java BigDecimal: Overview, Constructors, Methods, Formatting, and Common Exceptions

This article provides an in‑depth tutorial on Java's BigDecimal class, covering its purpose for high‑precision arithmetic, common constructors, usage pitfalls, essential methods, number formatting with NumberFormat, handling of division exceptions, and a recommended utility class for precise calculations.

ArithmeticBigDecimalJava
0 likes · 15 min read
Comprehensive Guide to Java BigDecimal: Overview, Constructors, Methods, Formatting, and Common Exceptions
Top Architect
Top Architect
Mar 20, 2023 · Backend Development

Comprehensive Guide to Java BigDecimal: Overview, Constructors, Methods, Formatting, and Common Exceptions

This article explains Java's BigDecimal class for high‑precision arithmetic, covering its purpose, common constructors, usage examples, essential arithmetic and comparison methods, formatting techniques with NumberFormat, handling of division exceptions, and a summary of best practices with a utility class example.

ArithmeticBigDecimalJava
0 likes · 16 min read
Comprehensive Guide to Java BigDecimal: Overview, Constructors, Methods, Formatting, and Common Exceptions
Java High-Performance Architecture
Java High-Performance Architecture
Dec 25, 2022 · Backend Development

Mastering Java BigDecimal: Precise Calculations, Constructors, and Common Pitfalls

This article provides a comprehensive guide to Java's BigDecimal class, covering its purpose for high‑precision arithmetic, common constructors, usage pitfalls with double values, essential methods, comparison techniques, formatting options, exception handling, and a utility class for everyday operations.

ArithmeticBackend DevelopmentBigDecimal
0 likes · 19 min read
Mastering Java BigDecimal: Precise Calculations, Constructors, and Common Pitfalls
Java Architect Essentials
Java Architect Essentials
Dec 7, 2022 · Backend Development

Comprehensive Guide to Java BigDecimal: Constructors, Methods, Formatting, and Common Pitfalls

This article explains Java's BigDecimal class, covering its purpose for high‑precision arithmetic, common constructors, essential methods such as add, subtract, multiply, divide, formatting techniques, handling of non‑terminating decimals, and provides a utility class with examples and best‑practice recommendations for developers.

ArithmeticBigDecimalJavaMath
0 likes · 15 min read
Comprehensive Guide to Java BigDecimal: Constructors, Methods, Formatting, and Common Pitfalls
Sanyou's Java Diary
Sanyou's Java Diary
Dec 5, 2022 · Backend Development

Avoid Costly Bugs: Mastering BigDecimal Pitfalls in Java

This article explains why using Java's BigDecimal is essential for precise financial calculations, outlines four common pitfalls—including floating-point errors, equality comparison, scale handling, and string conversion—and provides practical best-practice solutions with code examples and rounding mode guidance.

BigDecimalFinancial-CalculationsRoundingMode
0 likes · 14 min read
Avoid Costly Bugs: Mastering BigDecimal Pitfalls in Java
Java Backend Technology
Java Backend Technology
Sep 25, 2022 · Fundamentals

6 Common Java Pitfalls Every Developer Should Avoid

This article highlights six frequent Java pitfalls—including misuse of == with Integer, Objects.equals quirks, BigDecimal precision loss, Stream filter side‑effects, auto‑unboxing null errors, and String replace nuances—providing code examples and best‑practice recommendations to help developers write safer, more reliable code.

Auto-unboxingBigDecimalJava
0 likes · 12 min read
6 Common Java Pitfalls Every Developer Should Avoid
IT Services Circle
IT Services Circle
Aug 30, 2022 · Backend Development

Understanding Java BigDecimal: Solving Floating‑Point Precision Problems

This article explains why floating‑point numbers lose precision in binary representation, demonstrates the issue with Java float examples, and shows how to use the BigDecimal class—including creation, arithmetic operations, scaling, and proper equality comparison—to achieve exact decimal calculations in Java applications.

ArithmeticBigDecimalComparison
0 likes · 8 min read
Understanding Java BigDecimal: Solving Floating‑Point Precision Problems
Cognitive Technology Team
Cognitive Technology Team
Jul 30, 2022 · Fundamentals

Common Pitfalls of java.math.BigDecimal and How to Avoid Them

This article explains several common mistakes when using Java's BigDecimal—such as constructing it with a double, using valueOf, relying on equals for comparison, and misusing round—and provides correct alternatives like string constructors, valueOf with proper precision, compareTo, and setScale for reliable arithmetic.

BigDecimalJavabest practices
0 likes · 6 min read
Common Pitfalls of java.math.BigDecimal and How to Avoid Them
Java Backend Technology
Java Backend Technology
Jul 29, 2022 · Backend Development

Avoid the Top 5 BigDecimal Pitfalls in Java Money Calculations

This article explains five common BigDecimal traps—including constructor precision loss, equals vs compareTo, division exceptions, string conversion quirks, and operation order—provides code examples, and recommends using the JSR‑354 Money API with Maven for safer monetary calculations in Java backend development.

BackendBigDecimalJSR 354
0 likes · 8 min read
Avoid the Top 5 BigDecimal Pitfalls in Java Money Calculations
Senior Brother's Insights
Senior Brother's Insights
Jul 18, 2022 · Fundamentals

Avoid Costly Money Bugs: Mastering Java BigDecimal Pitfalls and Best Practices

This article explains why floating‑point types cause precision errors in financial calculations, reveals four common BigDecimal pitfalls—including constructor misuse, equality comparison, division precision, and string conversion—and provides concrete best‑practice solutions such as using String constructors, compareTo, specifying scale, and appropriate formatting methods.

BigDecimalFinancialJava
0 likes · 14 min read
Avoid Costly Money Bugs: Mastering Java BigDecimal Pitfalls and Best Practices
IT Services Circle
IT Services Circle
Jul 16, 2022 · Fundamentals

Common Java Pitfalls: Equality, Objects.equals, BigDecimal, Streams, Autoboxing, and String Replacement

This article explains six frequent Java pitfalls—including misuse of the == operator with Integer, subtle bugs in Objects.equals, precision loss with BigDecimal constructors, reference sharing in Stream.filter, NullPointerExceptions from autounboxing, and differences between replace, replaceAll, and replaceFirst—providing code examples and best‑practice recommendations.

AutoboxingBigDecimalJava
0 likes · 12 min read
Common Java Pitfalls: Equality, Objects.equals, BigDecimal, Streams, Autoboxing, and String Replacement
Su San Talks Tech
Su San Talks Tech
Jul 15, 2022 · Fundamentals

6 Common Java Pitfalls Every Developer Should Avoid

This article walks Java developers through six frequent pitfalls—including misuse of the == operator, subtle bugs in Objects.equals, precision issues with BigDecimal, unexpected Stream filter behavior, autoboxing/unboxing surprises, and string replace quirks—offering clear explanations, code examples, and best‑practice solutions to help avoid costly bugs.

AutoboxingBigDecimalJava
0 likes · 13 min read
6 Common Java Pitfalls Every Developer Should Avoid
Java Architect Essentials
Java Architect Essentials
Jun 9, 2022 · Backend Development

Understanding BigDecimal Precision Issues and Proper Usage in Java

This article explains why using floating‑point types for monetary calculations can cause precision loss, demonstrates the problem with BigDecimal constructors, analyzes the underlying double‑to‑long conversion, and provides a utility class with safe BigDecimal operations for backend Java applications.

BigDecimalFinancial-Calculationsprecision
0 likes · 9 min read
Understanding BigDecimal Precision Issues and Proper Usage in Java
Programmer DD
Programmer DD
Jun 8, 2022 · Fundamentals

Why BigDecimal Can Lose Precision: A Real-World Checkout Failure Explained

This article analyzes a checkout‑system outage caused by BigDecimal precision loss, reproduces the bug with Java code, explains the underlying double‑to‑long conversion issue, and recommends using String‑based construction for accurate monetary calculations.

BigDecimalFinancial-CalculationsJava
0 likes · 6 min read
Why BigDecimal Can Lose Precision: A Real-World Checkout Failure Explained
Java Captain
Java Captain
Jun 7, 2022 · Fundamentals

Understanding BigDecimal Precision Issues in Monetary Calculations and a Utility Class for Accurate Operations

This article explains why using floating‑point types with BigDecimal can cause precision loss in financial calculations, demonstrates the problem with sample code, analyzes the underlying double‑to‑long conversion, and provides a reusable Java utility class to perform accurate arithmetic with BigDecimal.

BigDecimalFinancialJava
0 likes · 8 min read
Understanding BigDecimal Precision Issues in Monetary Calculations and a Utility Class for Accurate Operations
Java High-Performance Architecture
Java High-Performance Architecture
Apr 16, 2022 · Backend Development

Mastering Java BigDecimal: Precise Calculations, Common Pitfalls, and Best Practices

This article explains Java's BigDecimal class, covering its purpose for high‑precision arithmetic, recommended constructors, essential methods, comparison techniques, formatting with NumberFormat, handling of division exceptions, and practical tips for efficient and accurate numeric computations.

ArithmeticBigDecimalException
0 likes · 14 min read
Mastering Java BigDecimal: Precise Calculations, Common Pitfalls, and Best Practices
Selected Java Interview Questions
Selected Java Interview Questions
Apr 3, 2022 · Fundamentals

Comprehensive Guide to Java BigDecimal: Overview, Constructors, Common Methods, Formatting, and Pitfalls

This article provides an in‑depth overview of Java's BigDecimal class, covering its purpose for high‑precision arithmetic, essential constructors, key methods for addition, subtraction, multiplication, division, formatting techniques, common exceptions, and practical utility code examples.

ArithmeticBigDecimalException
0 likes · 15 min read
Comprehensive Guide to Java BigDecimal: Overview, Constructors, Common Methods, Formatting, and Pitfalls
Programmer DD
Programmer DD
Aug 1, 2021 · Backend Development

Master Precise Calculations in Java: A Deep Dive into BigDecimal

This article explains why Java's BigDecimal class is essential for exact arithmetic beyond double's 16‑digit limit, details its constructors, common methods, formatting techniques, handling of division exceptions, and provides a utility class with high‑precision operations, all illustrated with clear code examples.

ArithmeticBigDecimalJava
0 likes · 15 min read
Master Precise Calculations in Java: A Deep Dive into BigDecimal
Spring Full-Stack Practical Cases
Spring Full-Stack Practical Cases
Apr 21, 2021 · Backend Development

Mastering Aviator: Advanced Java Expression Engine Examples

This guide demonstrates how to use the Aviator 5.2.5 expression engine on Java 8 with practical examples covering ternary operators, regex matching, variable shortcuts, nil handling, date comparisons, big number calculations, the powerful seq library, execution modes, and debugging techniques.

BigDecimalJavaexpression-engine
0 likes · 7 min read
Mastering Aviator: Advanced Java Expression Engine Examples
Programmer DD
Programmer DD
Mar 25, 2021 · Backend Development

Hidden Traps in Java’s JDK: Avoid These Common Pitfalls

This article reveals frequent JDK pitfalls such as missing null checks in String.valueOf, fragile Integer.parseInt conversions, BigDecimal division errors, unmodifiable Collections.emptyList, and unsafe list iteration, providing concrete code examples and safe handling recommendations for Java developers.

BigDecimalCollectionsJDK
0 likes · 10 min read
Hidden Traps in Java’s JDK: Avoid These Common Pitfalls
Su San Talks Tech
Su San Talks Tech
Feb 14, 2021 · Fundamentals

7 Common Java String Pitfalls and How to Avoid Them

This article walks through frequent Java string‑related mistakes—including misuse of replace vs replaceAll, Integer equality pitfalls, BigDecimal precision issues, StringBuilder versus String, isEmpty vs isBlank, MyBatis mapper null checks, and indexOf logic—providing clear explanations, code examples, and best‑practice recommendations.

BigDecimalCode reviewMyBatis
0 likes · 13 min read
7 Common Java String Pitfalls and How to Avoid Them
Full-Stack Internet Architecture
Full-Stack Internet Architecture
Feb 4, 2021 · Fundamentals

How to Correctly Create and Use BigDecimal in Java for Precise Calculations

BigDecimal provides precise arithmetic in Java, but its correct usage requires understanding its internal unscaled value and scale, avoiding the inaccurate BigDecimal(double) constructor, and preferring String or valueOf methods to accurately represent decimal numbers such as 0.1 in financial and e‑commerce applications.

BigDecimalFinancialJava
0 likes · 9 min read
How to Correctly Create and Use BigDecimal in Java for Precise Calculations
Liangxu Linux
Liangxu Linux
Nov 4, 2020 · Fundamentals

Why 0.2 + 0.1 Equals 0.30000000000000004 in JavaScript and How IEEE‑754 Handles Decimal Fractions

JavaScript’s 0.2 + 0.1 yielding 0.30000000000000004 stems from binary floating‑point representation, where many decimal fractions cannot be expressed exactly; the article explains decimal‑to‑binary conversion, the repeating binary of 0.1, IEEE‑754 format, and how to avoid precision loss using BigDecimal in Java.

BigDecimalIEEE-754Java
0 likes · 9 min read
Why 0.2 + 0.1 Equals 0.30000000000000004 in JavaScript and How IEEE‑754 Handles Decimal Fractions
Programmer DD
Programmer DD
Aug 21, 2020 · Backend Development

Master Precise Calculations in Java: A Deep Dive into BigDecimal

This article explains Java's BigDecimal class, covering its purpose, constructors, common methods, formatting techniques, handling of non‑terminating division, and best‑practice recommendations, while providing clear code examples and practical tips for accurate high‑precision arithmetic.

ArithmeticBigDecimalNumberFormat
0 likes · 19 min read
Master Precise Calculations in Java: A Deep Dive into BigDecimal
Programmer DD
Programmer DD
Jun 5, 2020 · Backend Development

How to Sum BigDecimal Values with Java Stream API and Reduce

This tutorial explains how to use Java's Stream API to sum numeric collections, demonstrates summing IntStream and DoubleStream values, and shows how to apply the reduce method to calculate sums for BigDecimal streams when a dedicated BigDecimalStream is unavailable.

BigDecimalJavaStream API
0 likes · 4 min read
How to Sum BigDecimal Values with Java Stream API and Reduce
Selected Java Interview Questions
Selected Java Interview Questions
May 30, 2020 · Backend Development

Understanding Precision Loss in Java's BigDecimal and Proper Usage

The article explains why floating‑point arithmetic in Java loses precision, demonstrates how even BigDecimal can suffer when constructed from double values, and shows the correct practice of using the BigDecimal(String) constructor together with utility methods to perform accurate monetary calculations.

BigDecimalJavaMonetary Calculations
0 likes · 9 min read
Understanding Precision Loss in Java's BigDecimal and Proper Usage
Programmer DD
Programmer DD
Oct 12, 2019 · Fundamentals

Mastering Java BigDecimal: Precise Arithmetic, APIs, and Best Practices

This article explains why commercial calculations should use Java's BigDecimal for exact decimal arithmetic, details its structure, shows how to construct instances safely, covers common API methods, rounding modes, number formatting, and provides practical code examples.

APIArithmeticBigDecimal
0 likes · 12 min read
Mastering Java BigDecimal: Precise Arithmetic, APIs, and Best Practices
Alibaba Cloud Developer
Alibaba Cloud Developer
Jun 17, 2019 · Fundamentals

5 Tricky Java Questions That Reveal Hidden Pitfalls

This article presents five Java code snippets—covering floating‑point comparison, wrapper equality, switch handling of null, BigDecimal construction, and lock usage—and challenges readers to identify the correct outcomes, exposing common misconceptions and best‑practice solutions.

BigDecimalconcurrencyfloating-point
0 likes · 4 min read
5 Tricky Java Questions That Reveal Hidden Pitfalls