Package java.text

Examples of java.text.NumberFormat.format()


         return fmt.format(val).concat(" MB");
      }
      val = size / 1024;
      if (val > 10)
      {
         return fmt.format(val).concat(" KB");
      }
      return fmt.format(val).concat(" bytes");
   }

   /**
 
View Full Code Here


      val = size / 1024;
      if (val > 10)
      {
         return fmt.format(val).concat(" KB");
      }
      return fmt.format(val).concat(" bytes");
   }

   /**
    * Split a string based on the given delimiter, but don't remove
    * empty elements.
View Full Code Here

    formatter.setMinimumFractionDigits(1);

    float mbValue = size;
    String format;
    if (mbValue < 1024) {
      format = formatter.format(mbValue) + " KB";
    } else {
      if (mbValue < 1048576) {
        mbValue /= 1024;
        format = formatter.format(mbValue) + " KB";
      } else {
View Full Code Here

    if (mbValue < 1024) {
      format = formatter.format(mbValue) + " KB";
    } else {
      if (mbValue < 1048576) {
        mbValue /= 1024;
        format = formatter.format(mbValue) + " KB";
      } else {
        if (mbValue < 109970456576L) {
          mbValue /= 1048576;
          format = formatter.format(mbValue) + " MB";
        } else {
View Full Code Here

        mbValue /= 1024;
        format = formatter.format(mbValue) + " KB";
      } else {
        if (mbValue < 109970456576L) {
          mbValue /= 1048576;
          format = formatter.format(mbValue) + " MB";
        } else {
          formatter.setMaximumFractionDigits(1);
          formatter.setMinimumFractionDigits(1);
          mbValue /= (float) 1048576;
          format = formatter.format(mbValue) + " KB";
View Full Code Here

          format = formatter.format(mbValue) + " MB";
        } else {
          formatter.setMaximumFractionDigits(1);
          formatter.setMinimumFractionDigits(1);
          mbValue /= (float) 1048576;
          format = formatter.format(mbValue) + " KB";
        }
      }
    }
    return format;
  }
View Full Code Here

      formatter.setMinimumFractionDigits(2);
    } else {
      formatter.setMaximumFractionDigits(1);
      formatter.setMinimumFractionDigits(1);
    }
    String format = formatter.format(speed);
    return format;
  }

  /**
   * Get the name of a file which is extracted from a file path.
View Full Code Here

      numberFormat.setMaximumFractionDigits(5);

      optUseDefaultFormat =
        new JRadioButton(s_stringMgr.getString("floatingPointBase.useDefaultFormat", new Double(3.14159).toString()));
      optUseLocaleDependendFormat =
        new JRadioButton(s_stringMgr.getString("floatingPointBase.uselocaleDependendFormat", numberFormat.format(new Double(3.14159))));



      setBorder(BorderFactory.createTitledBorder(s_stringMgr.getString("floatingPointBase.typeBigDecimal")));
View Full Code Here

  public void setBundlePriority(String bundleName, int priority) {
    Properties metadataProperties = getPropertiesWithoutResolvingRecursively(null, bundleName);
    if (priority > 999) { throw new AssertException(
        "Bundle priorities can not be higher than 999. The smaller the number, the higher the priority."); }
    NumberFormat formatter = new DecimalFormat("000");
    metadataProperties.setProperty(METADATA_BUNDLE_PRIORITY_KEY, formatter.format(priority));
    saveOrUpdateProperties(metadataProperties, null, bundleName);
  }

  /**
   * Set the key priority within the bundle. The smaller the number, the higher
View Full Code Here

  public void setKeyPriority(String bundleName, String key, int priority) {
    Properties metadataProperties = getPropertiesWithoutResolvingRecursively(null, bundleName);
    if (priority > 999) { throw new AssertException(
        "Bundle priorities can not be higher than 999. The smaller the number, the higher the priority."); }
    NumberFormat formatter = new DecimalFormat("00");
    metadataProperties.setProperty(key + METADATA_KEY_PRIORITY_POSTFIX, formatter.format(priority));
    saveOrUpdateProperties(metadataProperties, null, bundleName);
  }

  /**
   * Remove all bundles from caches to force reload from filesystem
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.