Here you can find the source of countLeadingSimilarBits(BitSet a, BitSet b)
private static int countLeadingSimilarBits(BitSet a, BitSet b)
//package com.java2s; //License from project: Apache License import java.util.BitSet; public class Main { private static int countLeadingSimilarBits(BitSet a, BitSet b) { int result = 0; for (int i = 127; i >= 0 && (a.get(i) == b.get(i)); i--) { result++;/*from w w w. j a va 2 s .com*/ } return result; } }