/**
 * @author lautturi.com
 * Java example: double to 2 decimal places
 */
public class Lautturi {
	public static void main(String[] args) {
		double value = 3.14159;
		String result = String.format("%.2f", value);
		System.out.println(result);
	}
}
output:
3.14