Here you can find the source of bitsToTransform(int src, int target)
public static int bitsToTransform(int src, int target)
//package com.java2s; //License from project: Open Source License public class Main { public static int bitsToTransform(int src, int target) { int counter = 0; while (!(src == 0 && target == 0)) { if (((src & 1) ^ (target & 1)) == 1) counter++;//from w ww.j ava 2 s . com src >>= 1; target >>= 1; } return counter; } }