Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

import java.util.Locale;

public class Main {
    public static String formatAmount(int amount, String currency) {
        if ("HUF".equals(currency)) {
            return String.format(Locale.US, "%d " + currency, amount);
        } else {
            StringBuilder stringBuilder = new StringBuilder();
            stringBuilder.append("%d,%02d ");
            stringBuilder.append(currency);
            return String.format(Locale.US, stringBuilder.toString(), amount / 100, amount % 100);
        }
    }
}