Integer.toBinaryString(0) = 0 Integer.toBinaryString(1) = 1 Integer.toBinaryString(2) = 10 Integer.toBinaryString(128) = 10000000 Integer.toBinaryString(Integer.MAX_VALUE) = 1111111111111111111111111111111 Integer.toBinaryString(Integer.MIN_VALUE) = 10000000000000000000000000000000 Integer.toBinaryString(Integer.MIN_VALUE+1) = 10000000000000000000000000000001 Integer.toBinaryString(-128) = 11111111111111111111111110000000 Integer.toBinaryString(-2) = 11111111111111111111111111111110 Integer.toBinaryString(-1) = 11111111111111111111111111111111 Integer.MAX_VALUE + 1 == Integer.MIN_VALUE
128 >> 1 = 64 128 : 00000000000000000000000010000000 64 : 00000000000000000000000001000000 128 >> 2 = 32 128 : 00000000000000000000000010000000 32 : 00000000000000000000000000100000 128 >> 3 = 16 128 : 00000000000000000000000010000000 16 : 00000000000000000000000000010000 128 >> 10 = 0 128 : 00000000000000000000000010000000 0 : 00000000000000000000000000000000 .-128 >> 1 = -64 .-128 : 11111111111111111111111110000000 .-64 : 11111111111111111111111111000000 .-128 >> 2 = -32 .-128 : 11111111111111111111111110000000 .-32 : 11111111111111111111111111100000 .-128 >> 3 = -16 .-128 : 11111111111111111111111110000000 .-16 : 11111111111111111111111111110000 .-128 >> 10 = -1 .-128 : 11111111111111111111111110000000 .-1 : 11111111111111111111111111111111
128 << 1 = 256 128 : 00000000000000000000000010000000 256 : 00000000000000000000000100000000 128 << 2 = 512 128 : 00000000000000000000000010000000 512 : 00000000000000000000001000000000 128 << 3 = 1024 128 : 00000000000000000000000010000000 1024 : 00000000000000000000010000000000 .-128 << 1 = -256 .-128 : 11111111111111111111111110000000 .-256 : 11111111111111111111111100000000 .-128 << 2 = -512 .-128 : 11111111111111111111111110000000 .-512 : 11111111111111111111111000000000 .-128 << 3 = -1024 .-128 : 11111111111111111111111110000000 .-1024 : 11111111111111111111110000000000
128 >>> 1 = 64 128 : 00000000000000000000000010000000 64 : 00000000000000000000000001000000 128 >>> 2 = 32 128 : 00000000000000000000000010000000 32 : 00000000000000000000000000100000 128 >>> 3 = 16 128 : 00000000000000000000000010000000 16 : 00000000000000000000000000010000 128 >>> 10 = 0 128 : 00000000000000000000000010000000 0 : 00000000000000000000000000000000 .-128 >>> 1 = 2147483584 .-128 : 11111111111111111111111110000000 2147483584 : 01111111111111111111111111000000 .-128 >>> 2 = 1073741792 .-128 : 11111111111111111111111110000000 1073741792 : 00111111111111111111111111100000 .-128 >>> 3 = 536870896 .-128 : 11111111111111111111111110000000 536870896 : 00011111111111111111111111110000 .-128 >>> 10 = 4194303 .-128 : 11111111111111111111111110000000 4194303 : 00000000001111111111111111111111
double
value that is not less than the argument and is equal to a mathematical integer.double
value that is not greater than the argument and is equal to a mathematical integer.double
value that is closest in value to the argument and is equal to a mathematical integer. If two double
values that are mathematical integers are equally close, the result is the integer value that is even.long
to the argument. The result is equal to the value of the expression:(long)Math.floor(a + 0.5d)
int
to the argument.double
value.double
value.double
value with a positive sign, greater than or equal to 0.0
and less than 1.0
.double
value.Math.round(-2.2) = -2 Math.round(-2.5) = -2 Math.round(-2.7) = -3 Math.round(2.2) = 2 Math.round(2.5) = 3 Math.round(2.7) = 3
Math.ceil(-2.2) = -2.0 Math.ceil(-2.5) = -2.0 Math.ceil(-2.7) = -2.0 Math.ceil(2.2) = 3.0 Math.ceil(2.5) = 3.0 Math.ceil(2.7) = 3.0
Math.floor(-2.2) = -3.0 Math.floor(-2.5) = -3.0 Math.floor(-2.7) = -3.0 Math.floor(2.2) = 2.0 Math.floor(2.5) = 2.0 Math.floor(2.7) = 2.0
Math.rint(-2.2) = -2.0 Math.rint(-2.5) = -2.0 Math.rint(-2.7) = -3.0 Math.rint(-3.2) = -3.0 Math.rint(-3.5) = -4.0 Math.rint(-3.7) = -4.0 Math.rint(2.2) = 2.0 Math.rint(2.5) = 2.0 Math.rint(2.7) = 3.0 Math.rint(3.2) = 3.0 Math.rint(3.5) = 4.0 Math.rint(3.7) = 4.0
millis
milliseconds for this thread to die. A timeout of 0
means to wait forever.System.gc(); Runtime.getRuntime().gc();
// Mémoire totale controlée par le programme et la JVM Runtime.getRuntime().totalMemory(); // Mémoire libre de votre programme pouvant être utiliser pour de nouveaux besoins Runtime.getRuntime().freeMemory();
public static String readFile(File a_file) throws IOException { FileReader file = null; file = new FileReader(a_file); StringBuffer l_stringBuffer = new StringBuffer(); int c = file.read(); while (c != -1) { l_stringBuffer.append((char)c); c = file.read(); } file.close(); String retour = l_stringBuffer.toString(); return retour; }
public static String readFile(File a_file) throws IOException { FileInputStream fin = new FileInputStream(a_file); FileChannel fc = fin.getChannel(); ByteBuffer buffer = ByteBuffer.allocate(4*1024); StringBuffer l_stringBuffer = new StringBuffer(); while (fc.read(buffer) != -1) { byte[] l_bytes = buffer.array(); String s = new String(l_bytes, 0, buffer.position()); l_stringBuffer.append(s); buffer.clear(); } String retour = l_stringBuffer.toString(); return retour; }