Archive for October, 2007

cast Double to String in java

Posted on October 26, 2007. Filed under: Java programming | Tags: , , , , , , |

Double to String casting …
if you want to display its String in number format (like this ###,###,##0.00) do not use these lines …

Double sk = 12300000000.35;
System.out.println(sk.toString());
System.out.println(String.valueOf(sk));

they would result like these ones:

1.230000000035E10
1.230000000035E10

use this one instead.

Double sk = 12300000000.35;
[...]

Read Full Post | Make a Comment ( 1 so far )

deprecated File toURL() method in Java 6

Posted on October 8, 2007. Filed under: Java programming | Tags: , , , , , , , , |

after upgrading to Java 6, I just found out that toURL() method is deprecated in Java 6.
after doing some googling, I reached to this page: http://www.jguru.com/faq/view.jsp?EID=1280051
The author (in the link above) said:

The toURL() method of File does not properly escape characters that aren’t valid in a URL. You can write better code today without waiting [...]

Read Full Post | Make a Comment ( 1 so far )

Liked it here?
Why not try sites on the blogroll...