Java tutorial
//package com.java2s; //License from project: Open Source License import java.text.DecimalFormat; public class Main { private static double BTC_RATE = 635.0; public static String BTC2Fiat(String btc) { double val = 0.0; try { val = Double.parseDouble(btc); } catch (NumberFormatException nfe) { val = 0.0; } DecimalFormat df = new DecimalFormat("######0.00"); return df.format(BTC2Fiat(val)); } public static double BTC2Fiat(double btc) { return btc * BTC_RATE; } }