Logarithmus zur Basis 2

Oneixee5

Top Contributor
Java:
    System.out.println(log(4, 2));
    System.out.println(log(1024, 2));
    System.out.println(log(1073741824, 2));

    static int log(final int x, final int base){
        return (int) (Math.log(x) / Math.log(base));
    }
 

Ähnliche Java Themen

Neue Themen


Oben