System.out.println(String.format("%6.3e",223.45654543434));
results in
2.235e+02
which is the closest I get.
more info : http://java.sun.com/j2se/1.5.0/docs/api/java/util/Formatter.html#syntax
More Related Contents:
- Change date format in a Java string
- How can I pad an integer with zeros on the left?
- Convert java.util.Date to String
- Double decimal formatting in Java
- How to print a float with 2 decimal places in Java?
- Convert Date/Time for given Timezone – java
- How can I convert byte size into a human-readable format in Java?
- Newline in JLabel
- Java output formatting for Strings
- How can I calculate a time span in Java and format the output?
- How to format a Java string with leading zero?
- How to print formatted BigDecimal values?
- How to convert current date into string in java?
- How to format LocalDate object to MM/dd/yyyy and have format persist
- Print out elements from an array with a comma between elements except the last word
- formatting a string to a currency format in jasper report
- Sprintf equivalent in Java
- How can I set date and time formatting in Java that respects the user’s OS settings
- Show padding zeros using DecimalFormat
- Java – format double value as dollar amount
- StAX XML formatting in Java
- Print out elements from an Array with a Comma between the elements
- JPanel Padding in Java
- Generate fixed length Strings filled with whitespaces
- How to round up integer division and have int result in Java? [duplicate]
- How can I remove punctuation from input text in Java?
- How to use String.format() in Java? [duplicate]
- Java printf using variable field size?
- Java decimal formatting using String.format?
- Force point (“.”) as decimal separator in java