Browse by Topic
Popular
Popular Posts
Latest
Latest Java Posts
Java BigDecimal: Precision, Rounding, and Performance
How to use Java BigDecimal for exact decimal arithmetic, including construction, rounding, comparison, and performance tradeoffs.
Java BigInteger: Arbitrary-Precision Arithmetic
java biginteger: Understand Java BigInteger for arbitrary-precision arithmetic: creation, operations, conversions, performance tradeoffs, and common pitfalls.
Java Random vs ThreadLocalRandom Comparison
Compare java.util.Random and ThreadLocalRandom in Java: how contention, thread safety, seeding, and API usage affect concurrency, and how to choose between them.
Java Secure Random: Using SecureRandom Instead of Random
This article explains how to generate secure random values in Java with SecureRandom: seeding, thread safety, performance, and when to use it instead of Random.
Java ThreadLocalRandom: Contention-Free Random Numbers
See how Java ThreadLocalRandom uses per-thread seed state to avoid contention, with code examples for bounded generation, primitive streams, and edge cases.
Java Random Range: Generate Integers in a Range
Learn how to generate random integers in a range in Java using Random, ThreadLocalRandom, SecureRandom, and the RandomGenerator interface.
Java Random nextInt: Usage, Bounds, and Thread Safety
java random nextint: Learn how to use Java's Random.nextInt() correctly, including range generation, bound handling, thread safety, and performance tradeoffs.
Java Random Class: Usage, Seeding, and Thread Safety
Learn how to use Java's Random class correctly: constructors, methods, seeding for reproducible tests, thread safety, and when to choose ThreadLocalRandom or SecureRandom.
Java Math.random(): Generating Random Numbers in Java
Learn how to use Java's Math.random() to generate random doubles and integers, avoid off-by-one errors, and choose between Random, ThreadLocalRandom, and SecureRandom.
Java Math.ceil and Math.floor: Rounding Direction Explained
Understand how Java's Math.ceil and Math.floor round doubles, including negative-number behavior, edge cases, and code examples for choosing the right method.