最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

比较两种不同长度的阵列

SEO心得admin78浏览0评论
本文介绍了比较两种不同长度的阵列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在开发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]; }
发布评论

评论列表(0)

  1. 暂无评论