Java Bits Convert to bitsToTransform(int src, int target)

Here you can find the source of bitsToTransform(int src, int target)

Description

bits To Transform

License

Open Source License

Declaration

public static int bitsToTransform(int src, int target) 

Method Source Code

//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;
    }
}

Related

  1. bitsString2(byte b)
  2. bitsTo8Bytes(boolean[] bits)
  3. bitsToBase64(byte data)
  4. bitsToDouble(String bits, double min, double max, int splits)
  5. bitsToFloats(boolean[] b)
  6. bitStr(long value)
  7. bitString(boolean value)
  8. bitString(byte b)
  9. bitString2byte(String str)