import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.charset.StandardCharsets;

public class Bits {
    public static void main(String[] args) {
        System.out.println("MAX+1 = " + (Integer.MAX_VALUE + 1));
        System.out.println("abs(MIN) = " + Math.abs(Integer.MIN_VALUE));
        String s = "😀";
        System.out.println("length = " + s.length() + ", codePoints = " + s.codePointCount(0, s.length()));
        byte[] b = "ə".getBytes(StandardCharsets.UTF_8);
        System.out.println("bytes = " + b[0] + ", " + b[1]);
        System.out.println("b[0] == 0xC9 ? " + (b[0] == 0xC9) + "; masked: " + ((b[0] & 0xFF) == 0xC9));
        System.out.println("0.1 + 0.2 = " + (0.1 + 0.2));
        System.out.println("ByteBuffer default = " + ByteBuffer.allocate(4).order() + ", native = " + ByteOrder.nativeOrder());
        int days = 25;
        int ms = days * 24 * 60 * 60 * 1000;
        long msOk = days * 24L * 60 * 60 * 1000;
        System.out.println("25 gun ms (Int) = " + ms + ", (Long) = " + msOk);
        System.out.println("-5 binary = " + Integer.toBinaryString(-5 & 0xFF));
        System.out.println("(byte)127+1 = " + (byte)(127 + 1));
        String t = "Salam 😀";
        System.out.println("take(7) = [" + t.substring(0, 7) + "] len=" + t.length());
    }
}
