Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

java String format for a long integer with at least 10 characters

I have a long integer that I want to be able to print out and write to a csv file. If I just write the string unformatted it prints 1.2345E9 instead of the full exact number. What String.format() should I use so that this prints out every single digit correctly.

like image 694
user565660 Avatar asked Jun 01 '12 13:06

user565660


1 Answers

This is probably just MS Excel formatting things "badly" for you. Check out this test.csv file here:

"COLUMN"
12345678901234567890

Opened in MS Excel

enter image description here

So check your CSV content. Probably, you don't have a Java formatting problem there

like image 79
Lukas Eder Avatar answered Oct 21 '22 18:10

Lukas Eder