示例
object Test1 {
def main(args: Array[String]): Unit = {
val pi = 3.1415927
println(new DecimalFormat("0").format(pi))
println(new DecimalFormat("0.00").format(pi))
println(new DecimalFormat("00.000").format(pi))
println(new DecimalFormat("#").format(pi))
println(new DecimalFormat("#.##%").format(pi))
println(new DecimalFormat("#%").format(pi))
val speed = 299792458
println(new DecimalFormat("#.#####E0").format(speed))
println(new DecimalFormat("#.####E0").format(speed))
println(new DecimalFormat(",###").format(speed))
println(new DecimalFormat("速度#").format(speed))
}
}