Format to Double Digit - Java java.lang

Java examples for java.lang:double Format

Description

Format to Double Digit

Demo Code


//package com.java2s;

public class Main {
    public static void main(String[] argv) throws Exception {
        int paramInt = 2;
        System.out.println(toDoubleDigit(paramInt));
    }//from   w w w  .  ja va  2  s .  com

    /**
     * 
     * @param paramInt
     * @return
     */
    public static String toDoubleDigit(int paramInt) {
        if (Math.abs(paramInt) < 10) {
            return ("0" + paramInt);
        }
        return "" + paramInt;
    }
}

Related Tutorials