Package java.text

Examples of java.text.DecimalFormatSymbols


        }
        else if (format instanceof DecimalFormat)

        {
            DecimalFormat dFormat = (DecimalFormat)format;
            DecimalFormatSymbols symbols = dFormat.getDecimalFormatSymbols();
            symbols.setCurrencySymbol(_currencySymbol);
            dFormat.setDecimalFormatSymbols(symbols);
        }
    }
View Full Code Here


    }


    private DecimalFormatSymbols getDecimalFormatSymbols()
    {
        return new DecimalFormatSymbols(getLocale());
    }
View Full Code Here

    }

    @Test
    public void testToString() {
        Assert.assertEquals("{3}", new Vector1D(3).toString());
        NumberFormat format = new DecimalFormat("0.000", new DecimalFormatSymbols(Locale.US));
        Assert.assertEquals("{3.000}", new Vector1D(3).toString(format));
    }
View Full Code Here

      {
        formatter = (DecimalFormat) NumberFormat.getNumberInstance(locale);
        formatter.setGroupingSize(
          Integer.valueOf(nDigitsPerGroupValue).intValue());
       
        DecimalFormatSymbols symbols = formatter.getDecimalFormatSymbols();
        symbols.setGroupingSeparator(digitGroupSepValue.charAt(0));
        formatter.setDecimalFormatSymbols(symbols);
        formatter.setGroupingUsed(true);
      }
      catch (NumberFormatException ex)
      {
View Full Code Here

      String len = contentLength >= 1024 ? toKB(contentLength) + " KB" : contentLength + " B";

      String throughput = "";
      long duration = System.currentTimeMillis() - resource.getTransferStartTime();
      if (duration > 0) {
        DecimalFormat format = new DecimalFormat("0.0", new DecimalFormatSymbols(Locale.ENGLISH));
        double kbPerSec = (contentLength / 1024.0) / (duration / 1000.0);
        throughput = " at " + format.format(kbPerSec) + " KB/sec";
      }

      out.println(type + ": " + resource.getRepositoryUrl() + resource.getResourceName() + " (" + len
View Full Code Here

   * string is null, zero length, or otherwise
   * malformed.
   */
  public Formatter(Locale locale, String fmtArg)
      throws IllegalArgumentException {
    dfs = new DecimalFormatSymbols(locale);
    int ePos=0;
    ConversionSpecification sFmt=null;
    String unCS = this.nonControl(fmtArg,0);
    if (unCS!=null) {
      sFmt = new ConversionSpecification();
View Full Code Here

    final StringBuffer sb = new StringBuffer();
   
    final String[] svmtypes = {"C_SVC", "NU_SVC","ONE_CLASS","EPSILON_SVR","NU_SVR"};
    final String[] kerneltypes = {"LINEAR", "POLY","RBF","SIGMOID","PRECOMPUTED"};
    final DecimalFormat dform = new DecimalFormat("#0.0#");
    final DecimalFormatSymbols sym = new DecimalFormatSymbols();
    sym.setDecimalSeparator('.');
    dform.setDecimalFormatSymbols(sym);
    sb.append("LIBSVM SETTINGS\n");
    sb.append("  SVM type      : " + svmtypes[param.svm_type] + " (" + param.svm_type + ")\n");
    sb.append("  Kernel        : " + kerneltypes[param.kernel_type] + " (" + param.kernel_type + ")\n");
    if (param.kernel_type == svm_parameter.POLY) {
View Full Code Here

      {
        formatter = (DecimalFormat) NumberFormat.getNumberInstance(locale);
        formatter.setGroupingSize(
          Integer.valueOf(nDigitsPerGroupValue).intValue());
       
        DecimalFormatSymbols symbols = formatter.getDecimalFormatSymbols();
        symbols.setGroupingSeparator(digitGroupSepValue.charAt(0));
        formatter.setDecimalFormatSymbols(symbols);
        formatter.setGroupingUsed(true);
      }
      catch (NumberFormatException ex)
      {
View Full Code Here

   *
   * @param dfp A DecimalFormatProperties to add to the hashtable of decimal formats.
   */
  void recomposeDecimalFormats(DecimalFormatProperties dfp)
  {
    DecimalFormatSymbols oldDfs =
                  (DecimalFormatSymbols) m_decimalFormatSymbols.get(dfp.getName());
    if (null == oldDfs)
    {
      m_decimalFormatSymbols.put(dfp.getName(), dfp.getDecimalFormatSymbols());
    }
View Full Code Here

    return (s.matches(INT));
  }

  public static String format(double n) throws ParseException
  {
    return (new DecimalFormat("#,##0.00", new DecimalFormatSymbols(new Locale("pt","BR")))).format(n);
  }
View Full Code Here

TOP

Related Classes of java.text.DecimalFormatSymbols

Copyright © 2018 www.massapicom. 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.