There is nothing incorrect. It turns out that 0.0000000000 is being represented by the scientific notation when viewed by debug.
Anyway, this will not cause any errors, since it is only a representation. Your accounts will be made with 0.
UPDATE - Complemented the answer:
I was curious about the fact that for some cases the toString() of Bigdecimal prints in scientific notation, for other cases not. I checked the source code and, as can be observed in the code snippet below, the decision is made based on the stored number.
The method below, layoutChars, is called by toString() passing by true to the parameter sci. The parameter sci means to print in scientific notation. If it is false, then the number is printed in engineering notation.
Note that it depends on some conditions for the number to be printed in the scientific notation, being the variable Scale, adjusted and the parameter sci responsible for this.
3051 private String layoutChars(boolean sci) {
3052 if (scale == 0) // zero scale is trivial
3053 return (intCompact != INFLATED) ?
3054 Long.toString(intCompact):
3055 intVal.toString();
3057 // Get the significand as an absolute value
3058 char coeff[];
3059 if (intCompact != INFLATED)
3060 coeff = Long.toString(Math.abs(intCompact)).toCharArray();
3061 else
3062 coeff = intVal.abs().toString().toCharArray();
3064 // Construct a buffer, with sufficient capacity for all cases.
3065 // If E-notation is needed, length will be: +1 if negative, +1
3066 // if '.' needed, +2 for "E+", + up to 10 for adjusted exponent.
3067 // Otherwise it could have +1 if negative, plus leading "0.00000"
3068 StringBuilder buf=new StringBuilder(coeff.length+14);
3069 if (signum() < 0) // prefix '-' if negative
3070 buf.append('-');
3071 long adjusted = -(long)scale + (coeff.length-1);
3072 if ((scale >= 0) && (adjusted >= -6)) { // plain number
3073 int pad = scale - coeff.length; // count of padding zeros
3074 if (pad >= 0) { // 0.xxx form
3075 buf.append('0');
3076 buf.append('.');
3077 for (; pad>0; pad--) {
3078 buf.append('0');
3079 }
3080 buf.append(coeff);
3081 } else { // xx.xx form
3082 buf.append(coeff, 0, -pad);
3083 buf.append('.');
3084 buf.append(coeff, -pad, scale);
3085 }
3086 } else { // E-notation is needed
3087 if (sci) { // Scientific notation
3088 buf.append(coeff[0]); // first character
3089 if (coeff.length > 1) { // more to come
3090 buf.append('.');
3091 buf.append(coeff, 1, coeff.length-1);
3092 }
3093 } else { // Engineering notation
3094 int sig = (int)(adjusted % 3);
3095 if (sig < 0)
3096 sig += 3; // [adjusted was negative]
3097 adjusted -= sig; // now a multiple of 3
3098 sig++;
3099 if (signum() == 0) {
3100 switch (sig) {
3101 case 1:
3102 buf.append('0'); // exponent is a multiple of three
3103 break;
3104 case 2:
3105 buf.append("0.00");
3106 adjusted += 3;
3107 break;
3108 case 3:
3109 buf.append("0.0");
3110 adjusted += 3;
3111 break;
3112 default:
3113 throw new AssertionError("Unexpected sig value " + sig);
3114 }
3115 } else if (sig >= coeff.length) { // significand all in integer
3116 buf.append(coeff, 0, coeff.length);
3117 // may need some zeros, too
3118 for (int i = sig - coeff.length; i > 0; i--)
3119 buf.append('0');
3120 } else { // xx.xxE form
3121 buf.append(coeff, 0, sig);
3122 buf.append('.');
3123 buf.append(coeff, sig, coeff.length-sig);
3124 }
3125 }
3126 if (adjusted != 0) { // [!sci could have made 0]
3127 buf.append('E');
3128 if (adjusted > 0) // force sign for positive
3129 buf.append('+');
3130 buf.append(adjusted);
3131 }
3132 }
3133 return buf.toString();
3134 }
Finally, the Java debug shown in the question image is calling toString() and the stored number, 0.0000000000, makes the printing in the scientific notation.
This code snippet was extracted from: http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/java/math/BigDecimal.java#Bigdecimal.toString%28%29
I tried that too @Brunocésar but keeps returning the "EO-10"
– Danilo Fernandes
If I try to take this Bigdecimal property, and call your toPlainString() method, it returns the value correctly.
– Danilo Fernandes
This is not incorrect @Danilofernandes. It is occurring that Bigdecimal is being represented in scientific notation. Note that 0E-10 = 0x(10(-10)) = 0/(10 10) = 0. In your question it is written incorrectly, it is EO-10, while in your debug it is 0E-10.
– cantoni