Here you can find the source of toScientific(double I, int digits)
public static String toScientific(double I, int digits)
//package com.java2s; //License from project: Open Source License import java.text.DecimalFormat; public class Main { public static String toScientific(double I, int digits) { StringBuffer strbuf = new StringBuffer("0."); for (int i = 0; i < digits; i++) strbuf.append("#"); strbuf.append("E0"); DecimalFormat df = new DecimalFormat(strbuf.toString()); return (df.format(I)); }//from ww w . ja v a2 s . com }