# Find index of largest value in array

**URL:** <https://community.konduit.ai/t/find-index-of-largest-value-in-array/221>\
**Category:** ND4J\
**Created:** [March 4, 2020, 3:15pm UTC](https://community.konduit.ai/t/find-index-of-largest-value-in-array/221 "2020-03-04T15:15:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Foodyborris](https://avatars.discourse-cdn.com/v4/letter/f/9fc29f/32.png) [@Foodyborris](https://community.konduit.ai/u/Foodyborris)\
**Post date:** [March 4, 2020, 3:15pm UTC](https://community.konduit.ai/t/find-index-of-largest-value-in-array/221/1 "2020-03-04T15:15:18Z")

</div>

Is there a convenient single function that takes an INDArray (1D if necessary) and returns the index of the largest item? I’m sure there must be something but I can’t find it.

Thanks

---

<div class="post-metadata">

**Author:** ![treo](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/treo/32/47_2.png) [@treo](https://community.konduit.ai/u/treo)\
**Post date:** [March 4, 2020, 3:20pm UTC](https://community.konduit.ai/t/find-index-of-largest-value-in-array/221/2 "2020-03-04T15:20:05Z")

</div>

I think you are looking for [argmax](https://deeplearning4j.org/api/latest/org/nd4j/linalg/api/ndarray/INDArray.html#argMax-int...-)

---

<div class="post-metadata">

**Author:** ![Foodyborris](https://avatars.discourse-cdn.com/v4/letter/f/9fc29f/32.png) [@Foodyborris](https://community.konduit.ai/u/Foodyborris)\
**Post date:** [March 4, 2020, 3:21pm UTC](https://community.konduit.ai/t/find-index-of-largest-value-in-array/221/3 "2020-03-04T15:21:12Z")

</div>

That looks about right - I’ll go and experiment. Many thanks for the quick reply.
