Java tutorial
//package com.java2s; public class Main { private static String getScalePattern(int scale) { StringBuffer sb = new StringBuffer("#0."); if (scale <= 0) { sb = new StringBuffer("#"); } for (int i = 0; i < scale; ++i) { sb.append("0"); } return sb.toString(); } }