java - BigDecimal constructor performance - string vs numeric -


new bigdecimal("10000"); new bigdecimal(10000); 

i know string constructor used if number bigger compiler accept, either of constructors faster other?

you can @ source code.

public bigdecimal(int val) {     intcompact = val; }  public bigdecimal(string val) {     this(val.tochararray(), 0, val.length()); }  public bigdecimal(char[] in, int offset, int len) {        ...very long } 

obviously, faster.


Comments

Popular posts from this blog

c# - Better 64-bit byte array hash -

webrtc - Which ICE candidate am I using and why? -

php - Zend Framework / Skeleton-Application / Composer install issue -