Tuesday, July 22, 2014

Getting the Index of, and Reading Length In Java

public class abejeroact47 {
public static void main(String []Args) {

Double d = 858.43;
String s = Double.toString(d);

int dot = s.indexOf('.');

System.out.println((s.length()-dot-1) + "\t digit after decimal point");

}
}

No comments:

Post a Comment