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 Fiat2BTC(String fiat) { double val = 0.0; try { val = Double.parseDouble(fiat); } catch (NumberFormatException nfe) { val = 0.0; } DecimalFormat df = new DecimalFormat("####0.0000"); return df.format(Fiat2BTC(val)); } public static double Fiat2BTC(double fiat) { return fiat / BTC_RATE; } }