public class demo1 {
public static void main(String[] args) {
// num
System.out.println(num());
}
public static int num(){
// 定义一个数组
int [] arr = {1,3,2,5};
// 设第一个最大,用它和其他的做比较
int max = arr[0];
// 遍历数组
for ( int i=1; i<arr.length; i++){
// 如果和后一个比较,后面的比较大,就把后面的值赋给max
if (max < arr[i]){
max = arr[i];
}
}
return max;
}
}java求数组最大值坐标 java数组怎么求最大值
转载本文章为转载内容,我们尊重原作者对文章享有的著作权。如有内容错误或侵权问题,欢迎原作者联系我们进行内容更正或删除文章。
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
python求数组最大值的位置 numpy求数组最大值
import numpy as npnp.max()
python求数组最大值的位置 numpy python -
transformers音频实战02-基于 Speech Commands 数据集的语音识别实战项目全流程
Speech Commands 数据集包含train(
#音视频 #语音识别 #人工智能 数据集 git
















