Package java.text

Examples of java.text.DecimalFormat.toPattern()


     */
    public String getElementPattern(final boolean localized) {
        final Format format = elementFormat;
        if (format instanceof DecimalFormat) {
            final DecimalFormat df = (DecimalFormat) format;
            return localized ? df.toLocalizedPattern() : df.toPattern();
        }
        if (format instanceof SimpleDateFormat) {
            final SimpleDateFormat df = (SimpleDateFormat) format;
            return localized ? df.toLocalizedPattern() : df.toPattern();
        }
View Full Code Here


            final DecimalFormat df = (DecimalFormat) format;
            return localized ? df.toLocalizedPattern() : df.toPattern();
        }
        if (format instanceof SimpleDateFormat) {
            final SimpleDateFormat df = (SimpleDateFormat) format;
            return localized ? df.toLocalizedPattern() : df.toPattern();
        }
        if (format instanceof AngleFormat) {
            return ((AngleFormat) format).toPattern();
        }
        return null;
View Full Code Here

    /**
     * @tests java.text.DecimalFormat#applyPattern(java.lang.String)
     */
    public void test_applyPatternLjava_lang_String() {
        DecimalFormat format = new DecimalFormat("#.#");
        assertEquals("Wrong pattern 1", "#0.#", format.toPattern());
        format = new DecimalFormat("#.");
        assertEquals("Wrong pattern 2", "#0.", format.toPattern());
        format = new DecimalFormat("#");
        assertEquals("Wrong pattern 3", "#", format.toPattern());
        format = new DecimalFormat(".#");
View Full Code Here

     */
    public void test_applyPatternLjava_lang_String() {
        DecimalFormat format = new DecimalFormat("#.#");
        assertEquals("Wrong pattern 1", "#0.#", format.toPattern());
        format = new DecimalFormat("#.");
        assertEquals("Wrong pattern 2", "#0.", format.toPattern());
        format = new DecimalFormat("#");
        assertEquals("Wrong pattern 3", "#", format.toPattern());
        format = new DecimalFormat(".#");
        assertEquals("Wrong pattern 4", "#.0", format.toPattern());
        // Regression for HARMONY-6485
View Full Code Here

        DecimalFormat format = new DecimalFormat("#.#");
        assertEquals("Wrong pattern 1", "#0.#", format.toPattern());
        format = new DecimalFormat("#.");
        assertEquals("Wrong pattern 2", "#0.", format.toPattern());
        format = new DecimalFormat("#");
        assertEquals("Wrong pattern 3", "#", format.toPattern());
        format = new DecimalFormat(".#");
        assertEquals("Wrong pattern 4", "#.0", format.toPattern());
        // Regression for HARMONY-6485
        format = new DecimalFormat();
        format.setMinimumIntegerDigits(0);
View Full Code Here

        format = new DecimalFormat("#.");
        assertEquals("Wrong pattern 2", "#0.", format.toPattern());
        format = new DecimalFormat("#");
        assertEquals("Wrong pattern 3", "#", format.toPattern());
        format = new DecimalFormat(".#");
        assertEquals("Wrong pattern 4", "#.0", format.toPattern());
        // Regression for HARMONY-6485
        format = new DecimalFormat();
        format.setMinimumIntegerDigits(0);
        format.setMinimumFractionDigits(0);
        format.setMaximumFractionDigits(0);
View Full Code Here

     *
     * @return
     */
    public static String getCurrencyPattern() {
        DecimalFormat df = ((DecimalFormat) NumberFormat.getCurrencyInstance());
        String pattern = df.getDecimalFormatSymbols().getCurrencySymbol() + df.toPattern().substring(1);
        return pattern;
    }

    public static int getLineWeightInPixels(int pWeight) {
        switch (pWeight) {
View Full Code Here

     *
     * @return
     */
    public static String getCurrencyPattern() {
        DecimalFormat df = ((DecimalFormat) NumberFormat.getCurrencyInstance());
        String pattern = df.getDecimalFormatSymbols().getCurrencySymbol() + df.toPattern().substring(1);
        return pattern;
    }

    public static int getLineWeightInPixels(int pWeight) {
        switch (pWeight) {
View Full Code Here

     *
     * @return
     */
    public static String getCurrencyPattern() {
        DecimalFormat df = ((DecimalFormat) NumberFormat.getCurrencyInstance());
        String pattern = df.getDecimalFormatSymbols().getCurrencySymbol() + df.toPattern().substring(1);
        return pattern;
    }

    public static int getLineWeightInPixels(int pWeight) {
        switch (pWeight) {
View Full Code Here

            ManagementFactory.getMemoryMXBean().getNonHeapMemoryUsage();

    format = NumberFormat.getIntegerInstance();
    if (format instanceof DecimalFormat) {
      DecimalFormat decf = (DecimalFormat)format;
      decf.applyPattern(decf.toPattern()+" KB");
    }
    stats.add(new StatRecord(getName(), "Max Heap mem", "long",
            format.format(heap.getMax()/1024), Level.INFO));
    stats.add(new StatRecord(getName(), "Used Heap", "long",
            format.format(heap.getUsed()/1024), Level.INFO));
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.