Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
/**
 * Title:        efa - elektronisches Fahrtenbuch fr Ruderer
 * Copyright:    Copyright (c) 2001-2011 by Nicolas Michael
 * Website:      http://efa.nmichael.de/
 * License:      GNU General Public License v2
 *
 * @author Nicolas Michael
 * @version 2
 */

public class Main {
    public static String int2String(int i, int digits) {
        return int2String(i, digits, true);
    }

    public static String int2String(int i, int digits, boolean leadingZero) {
        StringBuilder s = new StringBuilder(digits);
        s.append(Integer.toString(i));
        while (s.length() < digits) {
            s.insert(0, (leadingZero ? "0" : " "));
        }
        return s.toString();
    }
}