Java tutorial
//package com.java2s; //License from project: BSD License import java.util.Locale; public class Main { private static String getUnits(int amount, String unitName, String unitNamePlural) { if (amount == 1) return String.format("1 %s", unitName); return String.format(Locale.getDefault(), "%d %s", amount, unitNamePlural); } }