Example usage for java.text NumberFormat getIntegerInstance

List of usage examples for java.text NumberFormat getIntegerInstance

Introduction

In this page you can find the example usage for java.text NumberFormat getIntegerInstance.

Prototype

public static NumberFormat getIntegerInstance(Locale inLocale) 

Source Link

Document

Returns an integer number format for the specified locale.

Usage

From source file:org.mycore.datamodel.ifs2.MCRStore.java

private String createIDWithLeadingZeros(final int ID) {
    final NumberFormat numWithLeadingZerosFormat = NumberFormat.getIntegerInstance(Locale.ROOT);
    numWithLeadingZerosFormat.setMinimumIntegerDigits(idLength);
    numWithLeadingZerosFormat.setGroupingUsed(false);
    final String id = numWithLeadingZerosFormat.format(ID);
    return id;//from   w  w  w  . j a  v a 2  s  .c  o m
}

From source file:com.mgmtp.perfload.perfalyzer.PerfAlyzerModule.java

@Provides
@IntFormat// ww  w .  j a va  2  s  .c  o m
NumberFormat provideIntFormat(final Locale locale) {
    NumberFormat nf = NumberFormat.getIntegerInstance(locale);
    nf.setGroupingUsed(false);
    nf.setRoundingMode(RoundingMode.HALF_UP);
    return nf;
}