Search Java Code Snippets


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





Java - Code Samples

 Sample 1. 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