Holen Sie sich Index von Element Java

// if you're too lazy to do anything fancy
// here's a code snippet for ya

// replace 'TYPE' with whatever type your using
// like 'int' or 'String' for example
public static int indexOf(TYPE[] arr, TYPE element)
{
	for (int index = 0; index < arr.length; index++)
    {
    	if (arr[index] == element)
          	return index;
      	else break;
    }
  	
  	// the '-1' is the unique value to
  	// inform you that no element was found
  	return -1;
}
Tilted Turtle