Java Number Format formatTo2Digit(int number)

Here you can find the source of formatTo2Digit(int number)

Description

Used to format number in 2 digits

License

Open Source License

Parameter

Parameter Description
number the number to format

Return

the string representation in 2 digit for the given number

Declaration

private static String formatTo2Digit(int number) 

Method Source Code

//package com.java2s;
/*/*from  w  w  w  .j  a  va  2 s . c  o  m*/
 * EasyCukes is just a framework aiming at making Cucumber even easier than what it already is.
 * Copyright (C) 2014 Worldline or third-party contributors as
 * indicated by the @author tags or express copyright attribution
 * statements applied by the authors.
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 3.0 of the License.
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 */

public class Main {
    /**
     * Used to format number in 2 digits
     *
     * @param number the number to format
     * @return the string representation in 2 digit for the given number
     */
    private static String formatTo2Digit(int number) {
        return number < 10 ? "0" + number : Integer.toString(number);
    }
}

Related

  1. formatPrintIntegerToString(long number, boolean printCommasP, boolean printSignP, int radix, int mincol, char padchar, char commachar, int commainterval)
  2. formatRowKey(final long number, final int digits, byte[] dest)
  3. formatSafetyNumber(String digits)
  4. formatSheetNumber100(final int sheetNumber)
  5. formatSmallerNumber(String prefix, String suffix, long amnt, boolean useDecimals)
  6. NumberFormat(double str, int max, int min)
  7. numberFormat(double value, String format)
  8. numberFormat(int fractionDigits, Locale locale)
  9. numberFormat(int i)