Java Formatter Usage convertToMillions(double tmp)

Here you can find the source of convertToMillions(double tmp)

Description

convert To Millions

License

Open Source License

Declaration

static String convertToMillions(double tmp) 

Method Source Code

//package com.java2s;
/* *********************************************************************** *
 * project: org.matsim.*                                       *
 *                                                                         *
 * *********************************************************************** *
 *                                                                         *
 * copyright       : (C) 2008 by the members listed in the COPYING,        *
 *                   LICENSE and WARRANTY file.                            *
 * email           : info at matsim dot org                                *
 *                                                                         *
 * *********************************************************************** *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *   See also COPYING, LICENSE and WARRANTY file                           *
 *                                                                         *
 * *********************************************************************** */

import java.util.Formatter;

public class Main {
    static String convertToMillions(double tmp) {
        StringBuilder sb = new StringBuilder();
        Formatter formatter = new Formatter(sb);
        formatter.format("%12.6f mio", tmp / 1000. / 1000.);
        formatter.close();// ww w .  j a  v  a 2s  .c  o m
        return sb.toString();
        //      
        //      return Double.toString( ((long)(tmp/100./1000.))/10. ) + " mio";
    }
}

Related

  1. byteToHex(final byte[] bytes)
  2. byteToHexWithPrefix(final byte[] data)
  3. chatting(String fmt, Object... args)
  4. convertRGBDecToHex(String decimal)
  5. convertTimeToString(double d, String timeFormat)
  6. createHexadecimalString(byte[] data)
  7. digestToString(byte[] input)
  8. displayStackTrace()
  9. echo(Formatter script, String label, String message, String file)