Java default number to string behavior -


In my eclipse jurisdiction I have two projects that do the same thing, both are a special part of both projects where I Double to a string .

I have both projects String.valueOf (Var) .

In the old project, I always get a number like "-0.00097656" in a format which is required of the format. In the new I get the tenth exponential format like "Ten-ten .765625 E-4" I also have the fact that the old project cuts to reduce the string.

My question is: Which command can be due to this behavior that Java changes the default conversion output I have already searched the code but I do not see anything that does or does not This is probably an eclipse option?

I want to meet the old project with the old one and I do not want to use these string format every time in a new project. Anywhere in the old project there should be a setting or some call ...

There is hope that someone can give a signal.

This clearly explains in the javadoc format (see) depends on the magnitude of the number:

  • If m is greater than 10 or 10 -3 but 10 7 , Then it is represented as the integer part of the m, there is no leading zero in decimal shape by '.' ('\ U002E'), then represent partial part of one or more decimal digits m .

  • If m is less than 10 -3 or greater than 10 or 10 7 , It is shown in the so-called "computerized scientific notation". Let the unique integer should be such that <10> = m & lt; 10 n + 1 ; So one should be the exact quotient of mathematics and 10 n , so that 1 < = one & lt; 10. Then the magnitude is denoted as the integer part of a , as a decimal point, '.' ('\ U002E'), after the decimal point, representing the partial part of a , after the letter 'E' ('\ u0045'), n As a decimal integer, as is the method produced by Integer.toString (int) .

    If you want a specific format, use it or something else.

Comments