Package java.text

Examples of java.text.DecimalFormat.format()


          String quantity;
          String priceEachString;
          try
          {
            float tempFloat = (currencyFormat.parse(qty.getDisplayString())).floatValue();
            quantity = wholeNumberFormat.format(new Float(tempFloat));
          } //end of try block
          catch (Exception exception)
          {
            quantity = "0";
          } //end of catch block (Exception)
View Full Code Here



        String totalItems;
        try
        {
          totalItems = wholeNumberFormat.format(new Float(itemLines.getTotalItems()));
        } //end of try block
        catch (Exception exception)
        {
          totalItems = "0";
        }
View Full Code Here

  //  ================== Format number TO String ==================
  public static String format(Number number, String format)
  throws FunctionExecutionException {
    try {
          DecimalFormat df = new DecimalFormat(format);
          return df.format(number);
    } catch (IllegalArgumentException iae) {
      throw new FunctionExecutionException("ERR.015.001.0042", QueryPlugin.Util.getString("ERR.015.001.0042" , //$NON-NLS-1$ //$NON-NLS-2$
      iae.getMessage()));
    }
  }
View Full Code Here

          Integer s = new Integer((int)size);
          String sizeStr = s.toString();
          if (size > 1000000000)
          {
            size /= 1073741824;          // 1GB
            sizeStr = df.format(size) + "GB";
          } else if (size > 1000000) {
            size /= 1048576;            // 1MB
            sizeStr = df.format(size) + "MB";
          } else if (size > 1000) {
            size /= 1024;               // 1KB
View Full Code Here

          {
            size /= 1073741824;          // 1GB
            sizeStr = df.format(size) + "GB";
          } else if (size > 1000000) {
            size /= 1048576;            // 1MB
            sizeStr = df.format(size) + "MB";
          } else if (size > 1000) {
            size /= 1024;               // 1KB
            sizeStr = df.format(size) + "KB";
          }
          messageSize = new StringMember("Size", sizeStr, 10, "URL", 'T', false);
View Full Code Here

          } else if (size > 1000000) {
            size /= 1048576;            // 1MB
            sizeStr = df.format(size) + "MB";
          } else if (size > 1000) {
            size /= 1024;               // 1KB
            sizeStr = df.format(size) + "KB";
          }
          messageSize = new StringMember("Size", sizeStr, 10, "URL", 'T', false);
        }else{
          messageSize = new StringMember("Size", "1KB", 10, "URL", 'T', false);
        }
View Full Code Here

        symbols.setGroupingSeparator(groupingChar);
        symbols.setInternationalCurrencySymbol("EUR");

        DecimalFormat format = new DecimalFormat("###,###", symbols);
        format.setGroupingSize(3);
        return format.format(l) + " bytes";
    }
   
    public static String toString(Double d) {
        if (d == null) return "";
       
View Full Code Here

        symbols.setGroupingSeparator(groupingSep);
       
       
        DecimalFormat format = new DecimalFormat("###,###.00", symbols);
        format.setGroupingSize(3);
        return format.format(d);
    }

    public static Long getSize(File file) {
        return Long.valueOf(file.length())
    }
View Full Code Here

                pattern = pattern.replace('N', '#');
            }

            DecimalFormat format = new DecimalFormat(pattern);

            return format.format(number.doubleValue());

        } else {
            return getEmptyString();
        }
    }
View Full Code Here

     */
    public String decimal(Number number) {
        if (number != null) {
            DecimalFormat format = new DecimalFormat();

            return format.format(number.doubleValue());

        } else {
            return getEmptyString();
        }
    }
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.