Tabnine Logo
PrintStream.format
Code IndexAdd Tabnine to your IDE (free)

How to use
format
method
in
java.io.PrintStream

Best Java code snippets using java.io.PrintStream.format (Showing top 20 results out of 5,103)

Refine searchRefine arrow

  • PrintStream.println
origin: square/okhttp

 @Override public void update(long bytesRead, long contentLength, boolean done) {
  if (done) {
   System.out.println("completed");
  } else {
   if (firstUpdate) {
    firstUpdate = false;
    if (contentLength == -1) {
     System.out.println("content-length: unknown");
    } else {
     System.out.format("content-length: %d\n", contentLength);
    }
   }
   System.out.println(bytesRead);
   if (contentLength != -1) {
    System.out.format("%d%% done\n", (100 * bytesRead) / contentLength);
   }
  }
 }
};
origin: stackoverflow.com

 for (byte b : digest) {
  System.out.format("%02x", b);
}
System.out.println();
origin: stackoverflow.com

for(int i=1; i<13; i++){
   for(int j=1; j<13; j++){
     System.out.format("%5d", i * j);
   }
   System.out.println();  // To move to the next line.
 }
origin: marytts/marytts

public void printPar() {
  System.out.println("Features Read:\nframe\tOQG\tGOG\tSKG\tRCG\tIC");
  for (int i = 0; i < params.numfrm; i++)
    System.out.format("%d\t%.3f %.3f %.3f %.3f %.3f \n", i + 1, vq[0][i], vq[1][i], vq[2][i], vq[3][i], vq[4][i]);
}
origin: marytts/marytts

public void printPar() {
  System.out.println("Features Read:\nframe\tOQG\tGOG\tSKG\tRCG\tIC");
  for (int i = 0; i < params.numfrm; i++)
    System.out.format("%d\t%.3f %.3f %.3f %.3f %.3f \n", i + 1, vq[0][i], vq[1][i], vq[2][i], vq[3][i], vq[4][i]);
}
origin: marytts/marytts

public void printCoefficients() {
  if (coeffs != null) {
    for (int j = 0; j < coeffs.length; j++)
      System.out.format("coeff[%d]=%.5f\n", j, coeffs[j]);
  } else
    System.out.println("There is no coefficients to print.");
}
origin: marytts/marytts

public void printCoefficients() {
  if (coeffs != null) {
    for (int j = 0; j < coeffs.length; j++)
      System.out.format("coeff[%d]=%.5f\n", j, coeffs[j]);
  } else
    System.out.println("There is no coefficients to print.");
}
origin: marytts/marytts

public void printCoefficients(int[] indices, String[] factors) {
  if (coeffs != null) {
    System.out.println("Linear regression:");
    if (b0Term) {
      System.out.format(" %.5f\n", coeffs[0]);
      for (int j = 1; j < coeffs.length; j++)
        System.out.format(" %.5f (%s)\n", coeffs[j], factors[indices[j - 1]]);
    } else {
      for (int j = 0; j < coeffs.length; j++)
        System.out.format(" %.5f (%s)\n", coeffs[j], factors[indices[j]]);
    }
  } else
    System.out.println("There is no coefficients to print.");
}
origin: marytts/marytts

public void printCoefficients(int[] indices, String[] factors) {
  if (coeffs != null) {
    System.out.println("Linear regression:");
    if (b0Term) {
      System.out.format(" %.5f\n", coeffs[0]);
      for (int j = 1; j < coeffs.length; j++)
        System.out.format(" %.5f (%s)\n", coeffs[j], factors[indices[j - 1]]);
    } else {
      for (int j = 0; j < coeffs.length; j++)
        System.out.format(" %.5f (%s)\n", coeffs[j], factors[indices[j]]);
    }
  } else
    System.out.println("There is no coefficients to print.");
}
origin: Alluxio/alluxio

private static void printTasks(String target) {
 System.out.format("The following tasks are available to run on %s:%n", target);
 Collection<ValidationTask> tasks = TARGET_TASKS.get(target);
 for (ValidationTask task: tasks) {
  String taskName = TASKS.get(task);
  System.out.printf("%s: %s%n", taskName, TASK_DESCRIPTIONS.get(taskName));
 }
 System.out.println();
}
origin: marytts/marytts

public void printImportanceOfComponents() {
  System.out.println("Importance of components:");
  for (int j = 0; j < varianceProportion.length; j++)
    System.out.format("PC(%s)=%.4f ", j + 1, varianceProportion[j]);
  System.out.println();
}
origin: marytts/marytts

public void printCoefficients() {
  if (coeffs != null) {
    System.out.println("SoP coefficients (factor : factorIndex in FeatureDefinition)");
    for (int j = 0; j < coeffs.length; j++)
      System.out.format(" %.5f (%s : %d)\n", coeffs[j], factors[j], factorsIndex[j]);
  } else
    System.out.println("There is no coefficients to print (coeffs=null).");
}
origin: marytts/marytts

public void printCoefficients() {
  if (coeffs != null) {
    System.out.println("SoP coefficients (factor : factorIndex in FeatureDefinition)");
    for (int j = 0; j < coeffs.length; j++)
      System.out.format(" %.5f (%s : %d)\n", coeffs[j], factors[j], factorsIndex[j]);
  } else
    System.out.println("There is no coefficients to print (coeffs=null).");
}
origin: marytts/marytts

public void printImportanceOfComponents() {
  System.out.println("Importance of components:");
  for (int j = 0; j < varianceProportion.length; j++)
    System.out.format("PC(%s)=%.4f ", j + 1, varianceProportion[j]);
  System.out.println();
}
origin: stanfordnlp/CoreNLP

public static void printProperties(String message, Properties properties,
                  PrintStream stream) {
 if (message != null) {
  stream.println(message);
 }
 if (properties.isEmpty()) {
  stream.println("  [empty]");
 } else {
  List<Map.Entry<String, String>> entries = getSortedEntries(properties);
  for (Map.Entry<String, String> entry : entries) {
   if ( ! "".equals(entry.getKey())) {
    stream.format("  %-30s = %s%n", entry.getKey(), entry.getValue());
   }
  }
 }
 stream.println();
}
origin: apache/geode

private void dumpConfiguration() {
 System.out.println("-------------------------------------------");
 System.out.println("Configuration for container " + this);
 System.out.println("-------------------------------------------");
 LocalConfiguration configuration = getConfiguration();
 System.out.format("Name: %s%n", configuration);
 System.out.format("Class: %s%n", configuration.getClass());
 System.out.println("Properties:");
 configuration.getProperties().entrySet().forEach(System.out::println);
 System.out.println("-------------------------------------------");
 System.out.println("");
}
origin: Alluxio/alluxio

 /**
  * Prints usage for all commands.
  */
 protected void printUsage() {
  System.out.println("Usage: alluxio " + getShellName() + " [generic options]");
  SortedSet<String> sortedCmds = new TreeSet<>(mCommands.keySet());
  for (String cmd : sortedCmds) {
   System.out.format("%-60s%n", "\t [" + mCommands.get(cmd).getUsage() + "]");
  }
 }
}
origin: spotbugs/spotbugs

@NoWarning("FS")
public static void falsePositive() {
  System.out.printf("last updated %1$tY-%1$tm-%1$te %1$tH:%1$tM:%1$tS.%1$tL, threshold %2$d min.%n", new Date(), 20);
  java.util.Formatter f = new java.util.Formatter();
  System.out.println(String.format("%d %s", 8, "boy")); // no warning
  System.out.println(f.format("%d %s %f %d %f %d", 8, "boy", 7.7, 9, 9.9, 10)); // no
                                         // warning
  System.out.printf("%d", 7); // no warning
  System.out.format("%d", 8); // no warning
  System.out.println(f.format("%d %%%%%s %% %f %d %%%f %%%d", 8, "boy", 7.7, 9, 9.9, 10)); // no
                                               // warning
  System.out.println(String.format("%d %n", 1)); // no warning (%n does
                          // not consume an
                          // argument)
}
origin: guoguibing/librec

public static void main(String[] args) {
  // This prints out the values of the probability density function for N(2.0.0.6)
  // A graph of this is here: http://www.cs.bu.edu/fac/snyder/cs237/Lecture%20Materials/GaussianExampleJava.png
  double mu = 2.0;
  double sigma = 1.5;
  System.out.println("PDF for N(2.0,0.6) in range [-4..8]:");
  for (double z = -4.0; z <= 8.0; z += 0.2)
    System.out.format("%.1f\t%.4f\n", z, pdf(z, mu, sigma));
  // This prints out the values of the cumulative density function for N(2.0.0.6)
  // A graph of this is here: http://www.cs.bu.edu/fac/snyder/cs237/Lecture%20Materials/GaussianExample2Java.png
  System.out.println("CDF for N(2.0,0.6) in range [-4..8]:");
  for (double z = -4.0; z <= 8.0; z += 0.2)
    System.out.format("%.1f\t%.4f\n", z, cdf(z, mu, sigma));
  // Calculates the probability that for N(2.0, 0.6), the random variable produces a value less than 3.45
  System.out.format("\nIf X ~ N(2.0, 1.5), then P(X <= 3.2) is %.4f\n", cdf(3.2, 2.0, 1.5));
  // Calculates the value x for X ~ N(2.0, 0.6) which is the 78.81% cutoff (i.e., 78.81% of the values lie below x and 21.19% above).
  System.out.format("\nIf X ~ N(2.0, 1.5), then x such that P(X <= x ) = 0.7881 is %.4f\n",
      PhiInverse(0.7881, 2.0, 1.5));
}
origin: JCTools/JCTools

public static void main(final String[] args) throws Exception {
  System.out.println("capacity:" + ConcurrentQueueByTypeFactory.QUEUE_CAPACITY + " reps:" + REPETITIONS);
  final ConcurrentQueue<Integer> queue = ConcurrentQueueByTypeFactory.createQueue();
  final long[] results = new long[20];
  for (int i = 0; i < 20; i++) {
    System.gc();
    results[i] = performanceRun(i, queue);
  }
  // only average last 10 results for summary
  long sum = 0;
  for (int i = 10; i < 20; i++) {
    sum += results[i];
  }
  System.out.format("summary,QueuePerfTest,%s,%d\n", queue.getClass().getSimpleName(), sum / 10);
}
java.ioPrintStreamformat

Javadoc

Formats args according to the format string format, and writes the result to this stream. This method uses the user's default locale. See "Be wary of the default locale".

Popular methods of PrintStream

  • println
    Prints an array of characters and then terminate the line. This method behaves as though it invokes
  • print
    Prints an array of characters. The characters are converted into bytes according to the platform's d
  • <init>
  • printf
    Prints a formatted string. The behavior of this method is the same as this stream's #format(Locale,
  • flush
    Flushes the stream. This is done by writing any buffered output bytes to the underlying output strea
  • close
    Closes the stream. This is done by flushing the stream and then closing the underlying output stream
  • write
  • append
  • checkError
    Flushes the stream and checks its error state. The internal error state is set to true when the unde
  • setError
    Sets the error state of the stream to true. This method will cause subsequent invocations of #checkE
  • newline
    Put the line separator String onto the print stream.
  • ensureOpen
    Check to make sure that the stream has not been closed
  • newline,
  • ensureOpen,
  • newLine,
  • requireNonNull,
  • toCharset

Popular in Java

  • Reading from database using SQL prepared statement
  • getSupportFragmentManager (FragmentActivity)
  • onCreateOptionsMenu (Activity)
  • getSystemService (Context)
  • VirtualMachine (com.sun.tools.attach)
    A Java virtual machine. A VirtualMachine represents a Java virtual machine to which this Java vir
  • Graphics2D (java.awt)
    This Graphics2D class extends the Graphics class to provide more sophisticated control overgraphics
  • FileNotFoundException (java.io)
    Thrown when a file specified by a program cannot be found.
  • SecureRandom (java.security)
    This class generates cryptographically secure pseudo-random numbers. It is best to invoke SecureRand
  • Connection (java.sql)
    A connection represents a link from a Java application to a database. All SQL statements and results
  • TimeUnit (java.util.concurrent)
    A TimeUnit represents time durations at a given unit of granularity and provides utility methods to
  • From CI to AI: The AI layer in your organization
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now