遍历查找:
直接使用for循环从头到尾遍历查找
public class ArrayDemo01 {
public static void main(String[] args) {
//定义一个数组
int[] arr = {
10, 3, 43, 54, 6, 324, 546, 77, 324};
//根据元素查找出该元素在数组中第一次出现的索引
int index = getIndexByEle(arr, 6);
System.out.println("该元素第一次出现在数组中的索引是:"