比较两种不同长度的阵列

编程入门 行业动态 更新时间:2024-10-13 06:14:14
本文介绍了比较两种不同长度的阵列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

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

更多推荐

比较两种不同长度的阵列

本文发布于:2023-11-30 16:01:57,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1650612.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:两种   阵列   长度

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!