Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

12
LINES

< > BotCompany Repo | #1024770 // indexOfMaxEntryInIntArray

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (1654L/11K).

static int indexOfMaxEntryInIntArray(int[] a) {
  int bestIndex = -1, bestValue = Int.MIN_VALUE;
  int n = l(a);
  for i to n: {
    int x = a[i];
    if (x > bestValue) {
      bestIndex = i;
      bestValue = x;
    }
  }
  ret bestIndex;
}

download  show line numbers  debug dex  old transpilations   

Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1024770
Snippet name: indexOfMaxEntryInIntArray
Eternal ID of this version: #1024770/2
Text MD5: d14d02c0611cabfa7f0df2b9f09c0f5b
Transpilation MD5: d6a5bbafca4fb0878ac44726b988ac43
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-08-24 18:57:08
Source code size: 253 bytes / 12 lines
Pitched / IR pitched: No / No
Views / Downloads: 299 / 373
Version history: 1 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1030551 - indexOfMaxEntryInDoubleArray