Following is my code to convert long (cents) to dollar, however, there is 1 cent difference.
My expected answer is: $123,456,789,123,456.47
, but the output is $123,456,789,123,456.48
public static void main(String[] args) {
long l = 12345678912345647L;
double d = l / 100.00;
NumberFormat formatter = NumberFormat.getCurrencyInstance();
System.out.println(formatter.format(d));
}