Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java, fill CSV File with integer casted to String

Tags:

java

csv

I have an Integer value that is to long to be exported and displayed correctly in a CSV file.

the value is diaplyed like this:

1,13364E+12

instead of something like this:

08136677950770

I use BufferedWriter to write the file, and the code looks like this:

writer.write(data[0].toString());
writer.write(";");

I've tried like this:

writer.write("\'"+data[0].toString()+"\'");
writer.write(";");

but it displays this:

'08136677950770'

How can I display this value without the quotes?

08136677950770
like image 265
Marc El Bichon Avatar asked Jan 19 '26 03:01

Marc El Bichon


1 Answers

I recommend you using the BigInteger, that works with the String representation.

To get its value use simple toString() method.

BigInteger bi = new BigInteger("1234567890"); 
String str = bi.toString();
like image 172
Nikolas Charalambidis Avatar answered Jan 20 '26 19:01

Nikolas Charalambidis



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!