E8 Me

Posted on Sep 13, 2004

Here at work, some of our legacy code has the problem of primitive double and float primitives turning into scientific notation when they are concatenated to a String. Hence, a SQL statement ends up trying to use numbers with letters in them, and that’s not going to work.

The solution is to use your friend the java.text.NumberFormat class. After using the setGroupingUsed(boolean) and the setMaximumIntegerDigits(int) methods, my problems were over.

After I combed through all the code, bumping my way into places it was used. See the next quickie.