Java floor floorToPowerofTwo(int i)

Here you can find the source of floorToPowerofTwo(int i)

Description

floor To Powerof Two

License

Apache License

Declaration

public static int floorToPowerofTwo(int i) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static int floorToPowerofTwo(int i) { //returns the closest lower power of to from i
        int r = 1;
        for (int c = 1; c <= i; c *= 2) {
            r = c;/*from  w ww . ja v  a2 s .  c  o m*/
        }
        return r;
    }
}

Related

  1. floorSec(long milli)
  2. floorSec(long valueMs)
  3. floorSqrt(long i)
  4. floorToLong(float pX)
  5. floorToNearestNumberDivisibleByFour(long number)
  6. floorTs(long timestamp, int aggregationWindow)
  7. floory(double a, double precision)