You may want to consider converting this value to an int or long instead. This depends a lot on what you are doing with this value afterwards. You should realize that floating-point variables (ones with type float or double) are rarely ever exact representations. This especially becomes a problem if you need to compare equality between to numbers. If you need more information about the limitations of float and double, you should google for the specifics about how Java represents them in memory.