Be seen. Boost your question’s priority for more expert views and faster solutions
import java.text.*;
public class Test
{
public static void main(String args[])
{
DecimalFormat formatter = new DecimalFormat("000");
long nbr = 50;
String fmt_nbr = formatter.format(nbr);
System.out.println(fmt_nbr);
/*
Output:
050
*/
}
}
String.format("%03d", myLong);
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
Have a better answer? Share it in a comment.
Open in new window