Package java.text

Examples of java.text.DecimalFormat.format()


    // initialization
   
    DecimalFormat formatter = new DecimalFormat("0.00");
   
    min_file_size.setText(formatter.format(min));
    max_file_size.setText(formatter.format(max));
   
    min_file_size_units.select(initial_min_size_units);
    max_file_size_units.select(initial_max_size_units);
   
    file_extension.setText(initial_extension);
View Full Code Here


        text +=" Hashing [";
        DecimalFormat formatter = new DecimalFormat("0.00");
        String file_name = hashing_file.getSharingName();
        if (file_name.length()>20)
          file_name = file_name.substring(0, 20) + "...";
        text +=file_name+" : " + formatter.format(sharing_manager.getCurrentHashingFilePercent())+"%";
        text +="]";
      }
 
      shared_files_group.setText(text);
   
View Full Code Here

    setRowText(session,  SWTConstants.DOWNLOAD_LIST_FILE_NAME_COLUMN_ID, file_name);
    setRowText(session,  SWTConstants.DOWNLOAD_LIST_SIZE_COLUMN_ID, FileFormatter.formatFileSize(session.getFileSize()));
    setRowText(session,  SWTConstants.DOWNLOAD_LIST_TRANSFERRED_COLUMN_ID, FileFormatter.formatFileSize(session.getTransferredBytes()));
   
    DecimalFormat formatter = new DecimalFormat("0.00");
    setRowText(session,  SWTConstants.DOWNLOAD_LIST_COMPLETED_COLUMN_ID, formatter.format(session.getPercentCompleted())+"%");
   
    String speed = SpeedFormatter.formatSpeed(session.getSpeed());
    setRowText(session,  SWTConstants.DOWNLOAD_LIST_DOWNLOAD_SPEED_COLUMN_ID,speed);
   
    FileHash file_hash = session.getFileHash();
View Full Code Here

    long now = System.currentTimeMillis();
    DecimalFormat df = new DecimalFormat(DynamicTimeRangeFacetHandler.NUMBER_FORMAT);
    for(long l=0; l<53; l++)
    {
      Document d = new Document();
      d.add(buildMetaField("timeinmillis", df.format(now - l*3500000)));
      writer.addDocument(d);
      writer.optimize();
      writer.commit();
    }
    IndexReader idxReader = IndexReader.open(idxDir,true);
View Full Code Here

    if (oDec==null)
      return null;
    else {
    DecimalFormat oNumFmt = (DecimalFormat) NumberFormat.getNumberInstance(oLoc);
    oNumFmt.setMaximumFractionDigits(2);
    return oNumFmt.format(oDec);
    }
  } // getDecimalFormated

  /**
   * <p>Get double formated as a String using the given pattern and the symbols for the default locale</p>
View Full Code Here

   
    if (d >= 1000) {
      d = d / 1000d;
      result = " M";
    }
    result = formatter.format(d) + result;
    return result;
  }
 
}
View Full Code Here

            else if (oColClass.equals(ClassTimeStamp))
              strBuff.append (oXMLDate.format(new Date (((java.sql.Timestamp) oColValue).getTime())));

            else if (oColClass.equals(ClassBigDecimal) && (oDecFmt!=null))
              strBuff.append (oDecFmt.format((java.math.BigDecimal) oColValue));

            else if (oColClass.equals(ClassDouble) && (oDecFmt!=null))
              strBuff.append (oDecFmt.format(((java.lang.Double) oColValue).doubleValue()));

            else if (oColClass.equals(ClassFloat) && (oDecFmt!=null))
View Full Code Here

            else if (oColClass.equals(ClassBigDecimal) && (oDecFmt!=null))
              strBuff.append (oDecFmt.format((java.math.BigDecimal) oColValue));

            else if (oColClass.equals(ClassDouble) && (oDecFmt!=null))
              strBuff.append (oDecFmt.format(((java.lang.Double) oColValue).doubleValue()));

            else if (oColClass.equals(ClassFloat) && (oDecFmt!=null))
              strBuff.append (oDecFmt.format((double)((java.lang.Float) oColValue).floatValue()));

            else if (oColClass.equals(getClass()))
View Full Code Here

            else if (oColClass.equals(ClassDouble) && (oDecFmt!=null))
              strBuff.append (oDecFmt.format(((java.lang.Double) oColValue).doubleValue()));

            else if (oColClass.equals(ClassFloat) && (oDecFmt!=null))
              strBuff.append (oDecFmt.format((double)((java.lang.Float) oColValue).floatValue()));

            else if (oColClass.equals(getClass()))
              strBuff.append ("<"+getColumnName(iCol)+"s>\n"+((DBSubset)oColValue).toXML(sIdent+"  ", getColumnName(iCol), sDateFormat, sDecimalFormat)+"\n</"+getColumnName(iCol)+"s>\n");

            else
View Full Code Here

      long elapsed = elapsed();
      double perMilli = (double)iterations / (double)elapsed;
      DecimalFormat df = ((DecimalFormat)NumberFormat.getInstance());
      if (perMilli > 10000.) {
         df.applyPattern("########");
         return Timestamp.millisToNice(elapsed) + " for " + iterations + " iterations -> " + df.format(perMilli/1000) + " iterations/microsecond";
      }
      else if (perMilli > 100.)
         df.applyPattern("########");
      else if (perMilli > 10.)
         df.applyPattern("######.#");
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.