About 371,000 results
Open links in new tab
  1. Find the Index of an Array Element in Java - GeeksforGeeks

    Dec 9, 2024 · One of the simplest and most straightforward ways to find the index of an element in an array is by using a loop. You can iterate through the array and compare each element …

  2. How to find the index of an element in an array in Java?

    Nov 9, 2011 · return Arrays.asList(arr).indexOf(val); This creates a list wrapper for the input array using Arrays.asList and searches the index of the element with indexOf.

  3. Find the Index of an Element in a Java Array - Baeldung

    Dec 7, 2023 · In this tutorial, we’ll discuss various methods, with code examples, for finding the index of an array element using both Java’s built-in APIs and a third-party library. This can be …

  4. How to Get the Index of a Specified Element in an Array in Java?

    Dec 9, 2024 · In Java, to find the index of a specific element in an array, we can iterate through it and checking each element. There are several ways to achieve this, including using loops, …

  5. How to Return an Array in Java? - GeeksforGeeks

    Jun 29, 2022 · The java.lang.reflect.Array.getShort() is an in-built method of Array class in Java and is used to return the element present at a given index from the specified Array as a short. …

  6. java - How to return an array with the indexes of a certain int …

    Jul 14, 2021 · We can achieve this efficiently using any dynamic data structure. Like, use an ArrayList and keep adding all the desired indices one by one then convert the List to an array …

  7. java - How to find the index of an element in an int array? - Stack ...

    May 30, 2011 · Java provides us with an inbuilt function which can be found in the Arrays library of Java which will rreturn the index if the element is present, else it returns -1. The complexity …

  8. How to find index of Element in Java Array? - Tutorial Kart

    ArrayUtils.indexOf (array, element) method finds the index of element in array and returns the index. Java Program. Output. In this Java Tutorial, we learned how to find the index of an …

  9. Java: Find Index of Element in Array - Java Guides

    Finding the index of an element in an array is a common task in Java. This guide will cover different ways to find the index of an element in an array, including using loops, the Arrays …

  10. Java: Find the index of an array element - w3resource

    Apr 1, 2025 · Write a Java program to find the index of the last occurrence of a specific element in an array. Write a Java program to find the index of the maximum element in an integer array. …

  11. Some results have been removed
Refresh