What do you want to save?
Add Code snippet
New code examples in category Java
-
Alxna 2021-08-29 12:49:03
java double to string with 2 decimals
package com.mkyong; import java.math.RoundingMode; import java.text.DecimalFormat; public class DecimalExample { private static DecimalFormat df2 = new DecimalFormat("#.##"); public static void main(String[] args) { double i... Add solution -
Intcreator 2021-08-29 12:08:01
array null pointer java
class teste { public static void main(String[] args) { // U will most likekly get a null pointer //if u dont inicialize the arr like that int[] arr = new int[ARRAY_SIZE]; // Correct int[] arr; //incorrect and might have nullpointer } } Add solution -
S. Man 2021-08-29 10:18:02
formatting an integer in java
Default formatting: String.format("%d", 93); // prints 93 Specifying a width: String.format("|%20d|", 93); // prints: | 93| Left-justifying within the specified width: String.format("|%-20d|", 93); // ... Add solution -
Dangnabbit 2021-08-29 08:59:02
["org.elasticsearch.bootstrap.startupexception: java.lang.illegalstateexception: failed to obtain node locks,
sudo chown 1000:1000 <directory you wish to mount> # With docker sudo chown 1000:1000 /data/elasticsearch/ OR # With VM sudo chown elasticsearch:elasticsearch /data/elasticsearch/ Add solution