Created
February 9, 2016 11:36
-
-
Save c0rp-aubakirov/04512ce2b9118d7f7bbc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
public void testBigDecimal() throws Exception { | |
final Random random = new Random(); | |
for (int j = 0; j < 100; j++) { | |
long val = random.nextInt(); | |
Timer.executeFunctionWithTimer(() -> { | |
int value = 0; | |
for (int i = 0; i < 1000000; i++) { | |
value = new BigDecimal(val).intValueExact(); | |
} | |
return value > 10; | |
}); | |
Timer.executeFunctionWithTimer(() -> { | |
BigDecimal value = null; | |
for (int i = 0; i < 1000000; i++) { | |
value = new BigDecimal(val); | |
} | |
return value.compareTo(BigDecimal.TEN); | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment