Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // import java.text.DecimalFormat;
- private static String doubleToStringCSharpLike(double value) {
- int digits = 15;
- if (Math.abs(value) >= 1.0d) {
- digits -= Double.toString(value).split("[.,]")[0].length();
- }
- String format = "0." + new String(new char[digits]).replace("\0", "#");
- DecimalFormat df = new DecimalFormat(format);
- return df.format(value);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement