Package java.text

Examples of java.text.NumberFormat


    public double getModularity() {
        return modularity;
    }

    public String getReport() {
        NumberFormat f = new DecimalFormat("#0.000");

        String report = "<HTML> <BODY> <h1>Modularity Report </h1> "
                + "<hr>"
                + "<h2> Parameters: </h2>"
                + "Randomize:  " + (isRandomized ? "On" : "Off") + "<br>"
                + "<br> <h2> Results: </h2>"
                + "Modularity: " + f.format(modularity) + "<br>"
                + "Number of Communities: " + structure.communities.size()
                + "<br /><br />" + "<h2> Algorithm: </h2>"
                + "Vincent D Blondel, Jean-Loup Guillaume, Renaud Lambiotte, Etienne Lefebvre, <i>Fast unfolding of communities in large networks</i>, in Journal of Statistical Mechanics: Theory and Experiment 2008 (10), P1000<br />"
                + "</BODY> </HTML>";
View Full Code Here


package com.sun.ebank.web;
import java.text.NumberFormat;
import java.text.DecimalFormat;
public final class Currency extends Object {
   public static String format(double amount){
      NumberFormat nf = NumberFormat.getCurrencyInstance();
      DecimalFormat df = (DecimalFormat)nf;
      df.setMinimumFractionDigits(2);
      df.setMaximumFractionDigits(2);
      df.setDecimalSeparatorAlwaysShown(true);
      String pattern = "$###,###.00";
View Full Code Here

  ArrayList alist, Date timestamp){

    p2.removeAll();
    createPanelTwoActLabels();
    String custIDs=null;
    NumberFormat numFormat = NumberFormat.getNumberInstance(currentLocale);

    if(alist.size() != 0) {
      custIDs = alist.toString();
      this.cust = new JTextField(custIDs);
    } else {
      this.cust = new JTextField();
    }

    this.descrip = new JTextField(this.desc);
    this.type = new JTextField(type);
    //Internationalize date
    String viewtime = DateFormat.getDateInstance().format(timestamp);
    this.time = new JTextField(viewtime);

    //Internationalize numbers
    Double baldub = new Double(bal);
    String balstring = numFormat.format(baldub);
    this.bal = new JTextField(balstring);

    Double creditdub = new Double(creditline);
    String creditstring = numFormat.format(creditdub);
    this.credit = new JTextField(creditstring);

    Double begbaldub = new Double(begbalance);
    String begbalstring = numFormat.format(begbaldub);
    this.begbal = new JTextField(begbalstring);
    //Listen for Return action event
    this.begbal.addActionListener(ehandle);

    if(readonly == false) {
View Full Code Here

    env.add(new Property("Jetty Home", System.getProperty("jetty.home")));
    env.add(new Property("Java Runtime", System.getProperty("java.runtime.name") + " " + System.getProperty("java.runtime.version")));
   
    Runtime r = Runtime.getRuntime();
    long usedMemory = r.totalMemory() - r.freeMemory();
    NumberFormat f = DecimalFormat.getPercentInstance();
    f.setMinimumFractionDigits(1);
    String percentage = f.format(((float) usedMemory) / r.maxMemory());
    env.add(new Property("Memory", (usedMemory >> 20) + " Mb of " + (r.maxMemory() >> 20) + " Mb (" +
        percentage + ")"));
   
    env.add(new Property("Available processors", ManagementFactory.getOperatingSystemMXBean().getAvailableProcessors()));
    StringBuilder sb = new StringBuilder();
View Full Code Here

   public void setAmount(double a) {
      amount = a;
   }

   public String getFormat() {
        NumberFormat nf = NumberFormat.getCurrencyInstance(locale);
        return nf.format(amount);
   }
View Full Code Here

        }
        catch(NumberFormatException ex)
        {
            try
            {
                NumberFormat numberFormat = NumberFormat.getInstance(locale);
                val = numberFormat.parse(str).doubleValue();
            }
            catch(ParseException e)
            {
                throw new NumberFormatException(e.getMessage());
            }
View Full Code Here

        }
        catch(NumberFormatException ex)
        {
            try
            {
                NumberFormat numberFormat = NumberFormat.getInstance(locale);
                val = numberFormat.parse(str).intValue();
            }
            catch(ParseException e)
            {
                throw new NumberFormatException(e.getMessage());
            }
View Full Code Here

   public void setAmount(double a) {
      amount = a;
   }

   public String getFormat() {
        NumberFormat nf = NumberFormat.getCurrencyInstance(locale);
        return nf.format(amount);
   }
View Full Code Here

                0, 0));
        return button;
    }

    private String formatPoint(Point2D p) {
        NumberFormat formatter = getNumberFormatter();
        return "" + formatter.format(p.getX()) + ", " + formatter.format(p.getY());
    }
View Full Code Here

            }
        }
    }

    private static NumberFormat getNumberFormatter() {
        NumberFormat formatter = NumberFormat.getInstance(Locale.ENGLISH);
        formatter.setMinimumFractionDigits(2);
        formatter.setMaximumFractionDigits(2);
        return formatter;
    }
View Full Code Here

TOP

Related Classes of java.text.NumberFormat

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.