Java tutorial
//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 cent2euro(int cent, boolean currency) { String s = Integer.toString(cent); while (s.length() < 3) { s = "0" + s; } s = s.substring(0, s.length() - 2) + "," + s.substring(s.length() - 2, s.length()); if (s.endsWith(",00")) { s = s.substring(0, s.length() - 2) + "-"; } if (currency) { return s + " EUR"; } else { return s; } } }