We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- Java
- BigNumber
- Java BigDecimal
- Discussions
Java BigDecimal
Java BigDecimal
Sort by
recency
|
475 Discussions
|
Please Login in order to post a comment
I can see a lot of elegant solutions here, but I did it with a custom class
A simple one for java 8
this works:
Is this one even doable? The difficulty is comparing a String that may appear many times which compares to the same BigDecimal value -> that's where I'm getting stopped. Then picking the correct String from the original unordered array.
Arrays.sort(s, (a, b) -> -(new BigDecimal(a).compareTo(new BigDecimal(b))));