java how to find the highest power of 2 that divides a number

java how to find the highest power of 2 that divides a number
public class HighestPowerOf2 {
	private static int highestPowerOfTwo(int n) {
		return (n & (~(n - 1)));
	}

	public static void main(String[] args) {
		System.out.println(highestPowerOfTwo(48)); // 16
		System.out.println(highestPowerOfTwo(5)); // 1
	}
}
‮ww:ecruoS‬w.lautturi.com
Created Time:2017-09-11 16:43:47  Author:lautturi