Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.text.DecimalFormat;

public class Main {
    /** Multiplier for meters to feet. **/
    private static final double FEET_CONVERT = 3.2808399;

    public static String asFeetString(final double meters) {
        return asFeet(meters) + " ft";
    }

    /**
     * Convert a number of meters to feet.
     * @param meters Value to convert in meters.
     * @return meters converted to feet.
     */
    public static double asFeet(final double meters) {
        DecimalFormat twoDForm = new DecimalFormat("#.##");
        return Double.valueOf(twoDForm.format(meters * FEET_CONVERT));
    }
}