Package java.text

Examples of java.text.DecimalFormat.applyPattern()


  public Object createObject()
  {
    final DecimalFormat format = (DecimalFormat) super.createObject();
    if (getParameter("pattern") != null)
    {
      format.applyPattern((String) getParameter("pattern"));
    }
//        if (getParameter("localizedPattern") != null) {
//            format.applyLocalizedPattern((String) getParameter("localizedPattern"));
//        }
    return format;
View Full Code Here


      stop();
      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.)
View Full Code Here

      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("######.#");
      else if (perMilli > 0.1) {
         df.applyPattern("######.#");
         return Timestamp.millisToNice(elapsed) + " for " + iterations + " iterations -> " + df.format(perMilli*1000) + " iterations/second";
View Full Code Here

         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("######.#");
      else if (perMilli > 0.1) {
         df.applyPattern("######.#");
         return Timestamp.millisToNice(elapsed) + " for " + iterations + " iterations -> " + df.format(perMilli*1000) + " iterations/second";
      }
      else {
View Full Code Here

      else if (perMilli > 100.)
         df.applyPattern("########");
      else if (perMilli > 10.)
         df.applyPattern("######.#");
      else if (perMilli > 0.1) {
         df.applyPattern("######.#");
         return Timestamp.millisToNice(elapsed) + " for " + iterations + " iterations -> " + df.format(perMilli*1000) + " iterations/second";
      }
      else {
         df.applyPattern("##########");
         return Timestamp.millisToNice(elapsed) + " for " + iterations + " iterations -> " + df.format(perMilli*1000) + " iterations/second";
View Full Code Here

      else if (perMilli > 0.1) {
         df.applyPattern("######.#");
         return Timestamp.millisToNice(elapsed) + " for " + iterations + " iterations -> " + df.format(perMilli*1000) + " iterations/second";
      }
      else {
         df.applyPattern("##########");
         return Timestamp.millisToNice(elapsed) + " for " + iterations + " iterations -> " + df.format(perMilli*1000) + " iterations/second";
      }
      return Timestamp.millisToNice(elapsed) + " for " + iterations + " iterations -> " + df.format(perMilli) + " iterations/millisecond";
   }

View Full Code Here

      DecimalFormat retVal = null;
      if(n!=null){
        retVal = getFileNumberFormatter(n.intValue());
      }else{
        retVal = new DecimalFormat();
        retVal.applyPattern("00000");
      }
      return retVal;
    }
    /**
     * @param n number of pages
View Full Code Here

     * @return the DecimalFormat
     */
    private DecimalFormat getFileNumberFormatter(int n){
      DecimalFormat retVal = new DecimalFormat();
      try {
        retVal.applyPattern(Integer.toString(n).replaceAll("\\d", "0"));
    } catch (Exception fe) {
      retVal.applyPattern("00000");
    }
    return retVal;
    }
View Full Code Here

    private DecimalFormat getFileNumberFormatter(int n){
      DecimalFormat retVal = new DecimalFormat();
      try {
        retVal.applyPattern(Integer.toString(n).replaceAll("\\d", "0"));
    } catch (Exception fe) {
      retVal.applyPattern("00000");
    }
    return retVal;
    }

    /**
 
View Full Code Here

     */
    private DecimalFormat getFileNumberFormatter(String arg0){
      DecimalFormat retVal = new DecimalFormat();
      try {
        if(arg0!=null && arg0.length()>0){
          retVal.applyPattern(arg0.replaceAll("#", "0"));
        }else{
          retVal.applyPattern("00000");
        }
    } catch (Exception fe) {
      retVal.applyPattern("00000");
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.