Search Java Code Snippets


  Help us in improving the repository. Add new snippets through 'Submit Code Snippet ' link.





#Java - Code Snippets for '#NumberFormat' - 2 code snippet(s) found

 Sample 1. Usage of java.text.NumberFormat

NumberFormat formatter = null;
if (locale != null) {
formatter = NumberFormat.getNumberInstance(locale);
} else {
formatter = NumberFormat.getNumberInstance(Locale.getDefault());
}

   Like      Feedback     NumberFormat  Locale


 Sample 2. Code Sample / Example / Snippet of java.text.NumberFormat

  public static String getUniqueName(JobConf conf, String name) {

int partition = conf.getInt("mapred.task.partition", -1);

if (partition == -1) {

throw new IllegalArgumentException(

"This method can only be called from within a Job");

}



String taskType = (conf.getBoolean("mapred.task.is.map", true)) ? "m" : "r";



NumberFormat numberFormat = NumberFormat.getInstance();

numberFormat.setMinimumIntegerDigits(5);

numberFormat.setGroupingUsed(false);



return name + "-" + taskType + "-" + numberFormat.format(partition);

}


   Like      Feedback      java.text.NumberFormat



Subscribe to Java News and Posts. Get latest updates and posts on Java from Buggybread.com
Enter your email address:
Delivered by FeedBurner