Package java.util

Examples of java.util.Formatter.format()


    private String wordProbToString(double[] prob) {
        Formatter formatter = new Formatter();
        for(int j=0;j<prob.length;++j) {
            double p = prob[j];
            if (p>=0.00001) {
                formatter.format(" %s:%.5f", langlist.get(j), p);
            }
        }
        String string = formatter.toString();
        formatter.close();
        return string;
View Full Code Here


            dgest.update(buffer, 0, readLen);
        }
        str.close();
        Formatter fmt = new Formatter();
        for (byte b : dgest.digest()) {
            fmt.format("%02X", b);
        }
        String result = fmt.toString();
        fmt.close();
        return result;
    }
View Full Code Here

    int bucketWidth = (int)Math.ceil((float)(max - min) / height);
    int[] counts = count(bucketWidth, values);
    int maxCount = max(counts);
    StringBuilder out = new StringBuilder();
    Formatter formatter = new Formatter(out);
    formatter.format("%8d %" + width + "d", 0, maxCount);
    rows[0] = out.toString();
    for (int i = 0; i < counts.length; i++) {
      out.setLength(0);
      int bucketId = (int) (min + bucketWidth * i + bucketWidth / 2f);
      PieGraph pieGraph = new PieGraph(width, new CharMarker(marker.get(i, bucketId), ' '));
View Full Code Here

    for (int i = 0; i < counts.length; i++) {
      out.setLength(0);
      int bucketId = (int) (min + bucketWidth * i + bucketWidth / 2f);
      PieGraph pieGraph = new PieGraph(width, new CharMarker(marker.get(i, bucketId), ' '));
      String bar = pieGraph.render(counts[i], maxCount - counts[i]);
      formatter.format("%6d |%s:%6d", bucketId, bar, counts[i]);
      rows[i + 1] = out.toString();
    }
    return rows;
  }

View Full Code Here

        } else {
          LOG.info( "Will move " + StringUtils.byteDesc(bytesToMove) +
              "bytes in this iteration");
        }
  
        formatter.format("%-24s %10d  %19s  %18s  %17s\n",
            DateFormat.getDateTimeInstance().format(new Date()),
            iterations,
            StringUtils.byteDesc(bytesMoved.get()),
            StringUtils.byteDesc(bytesLeftToMove),
            StringUtils.byteDesc(bytesToMove)
View Full Code Here

               formatter = new Formatter(outBuf);
            }
            /*
             * leading %, 0 padded, width 2, capital hex
             */
            formatter.format("%%%02X", (int) c);// TODO
         }
      }
      return outBuf != null ? outBuf : in;
   }

View Full Code Here

    @Override
    public String toString() {
        // Output into coordinate format. Indices start from 1 instead of 0
        Formatter out = new Formatter();

        out.format("%10d %10d %19d\n", numRows, numColumns, Matrices
                .cardinality(this));

        int i = 0;
        for (MatrixEntry e : this) {
            if (e.get() != 0)
View Full Code Here

                .cardinality(this));

        int i = 0;
        for (MatrixEntry e : this) {
            if (e.get() != 0)
                out.format("%10d %10d % .12e\n", e.row() + 1, e.column() + 1, e.get());
            if (++i == 100) {
                out.format("...\n");
                break;
            }
        }
View Full Code Here

        int i = 0;
        for (MatrixEntry e : this) {
            if (e.get() != 0)
                out.format("%10d %10d % .12e\n", e.row() + 1, e.column() + 1, e.get());
            if (++i == 100) {
                out.format("...\n");
                break;
            }
        }

        return out.toString();
View Full Code Here

    @Override
    public String toString() {
        // Output into coordinate format. Indices start from 1 instead of 0
        Formatter out = new Formatter();

        out.format("%10d %19d\n", size, Matrices.cardinality(this));

        int i = 0;
        for (VectorEntry e : this) {
            if (e.get() != 0)
                out.format("%10d % .12e\n", e.index() + 1, e.get());
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.