e, Apr 1, 2025 at 7:58 AM Sathish Kumar Thiyagarajan <
> sathishkumar.thiyagara...@gmail.com> wrote:
>
>> However, *Jackson (and most JSON parsers) default to Integer for whole
>> numbers* because they rely on Integer.parseInt(String), which is a safe
>> fallback for mo
Number(String)` in the `testNumberMemoryUsage()` method.
> Example: *"I have this test method verifying this behavior of that
> application. Given a `Number#parseNumber(String)`, I can improve this as
> follows."*
>
> On Fri, Mar 28, 2025 at 6:31 PM Sathish Kumar Thiyagaraj
class that provides
> frequently needed conversions and optimizations?
Would love to hear your thoughts on whether such an approach would be
useful and where it might fit within the broader discussion around numeric
types in Java.
Best regards,
Sathish Kumar Thiyagarajan
On Sat, 29 Mar 2025 at
ls
BigDecimal bd = new BigDecimal(numberStr);
try {
// Convert to BigInteger if there's no fraction
return bd.toBigIntegerExact();
} catch (ArithmeticException ex) {
return bd; // If it's a decimal, return BigDecimal
}