why is my primality test failing so often when randomizing a BigInteger?

I wasn’t able to get true for both p and q, most of the results is both false or rarely p is true but q is false, why wouldn’t this test ever be true for both p and q? BigInteger bitSize100 = new …

BigDecimal gives unexpected results for numbers larger than 7 or 0 decimal numbers

While trying to calculate a ratio of the volume of 2 objects, I noticed some weirdness in the calculation, here is a sample you can run for yourself: public class TestApplication { public static …

How likely is BigDecimal to cause memory issues for a POS program?

I understand that BigDecimal is the most accurate way to express currency because treating currency values as a floating-point data type tends to cause rounding errors. However, I also understand that …

How to change the decimal separator of DecimalFormat from comma to dot/point?

I have this little crazy method that converts BigDecimal values into nice and readable Strings. private String formatBigDecimal(BigDecimal bd){ DecimalFormat df = new DecimalFormat(); df….

Which PostgreSQL column type should be used to store a Java BigDecimal?

What PostgreSQL column type should I use to store a Java BigDecimal?