我正在开发Android上的一个程序,将比较使用手势点手势的相似性。我有两个数组是这样的:
I am developing a program on Android that will compare the similarity of Gestures using Gesture Points. I have two arrays like this:
gest_1 = [120,333,453,564,234,531] gest_2 = [222,432,11,234,223,344,534,523,432,234]我知道有没有办法来动态调整阵列中的任何一个,那么,有没有办法为我用这些阵列来比较这两种手势和返回的相似性?
I know there is no way to dynamically resize either one of the arrays, so is there any way for me to compare both these gestures using these arrays and return the similarity?
请注意,在阵列中的数据都只是随机输入了。
Note that the data in the arrays are just randomly typed out.
推荐答案您可以尝试这样的事:
List similarities = new ArrayList(); for(int i = 0; i < Math.max(gest_1.length, gest_2.length); i++){ if (gest_1[i] == gest_2[i]) similarities.add(gest_1[i]; }