DecimalFormat("###E0") (exponent must be multiple of 3)
import java.text.DecimalFormat; public class Main { public static void main(String[] argv) { DecimalFormat formatter = new DecimalFormat("###E0"); String s = formatter.format(-1234.567); // -1.23E3 System.out.println(s); s = formatter.format(-123.4567); // -123E0 System.out.println(s); s = formatter.format(-12.34567); // -12.3E0 System.out.println(s); s = formatter.format(-1.234567); // -12.3E0 System.out.println(s); s = formatter.format(-.1234567); // -123E-3 System.out.println(s); } }