get Hamming Distance between two int array - Android Graphics

Android examples for Graphics:Bitmap Byte Array

Description

get Hamming Distance between two int array

Demo Code


//package com.book2s;

public class Main {
    public static int getHammingDistance(int[] a, int[] b) {
        int sum = 0;
        for (int i = 0; i < a.length; i++) {
            sum += a[i] == b[i] ? 0 : 1;
        }//w ww . j  av  a2s  .  c om
        return sum;
    }
}

Related Tutorials