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

11
LINES

< > BotCompany Repo | #1035925 // indexOfHighest

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

Libraryless. Click here for Pure Java version (9202L/50K).

static int indexOfHighest(int[] array) {
  if (empty(array)) ret -1;
  int idx = 0, val = array[0];
  for (int i = 1; i < array.length; i++) {
    if (array[i] > val) {
      val = array[i];
      idx = i;
    }
  }
  ret idx;
}

download  show line numbers  debug dex  old transpilations   

Travelled to 2 computer(s): elmgxqgtpvxh, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1035925
Snippet name: indexOfHighest
Eternal ID of this version: #1035925/1
Text MD5: 49428da858c80c27a347261e9cf92e0b
Transpilation MD5: dbdac08f2b84645e90af72dcd0c95ed0
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-08-14 19:46:28
Source code size: 238 bytes / 11 lines
Pitched / IR pitched: No / No
Views / Downloads: 55 / 74
Referenced in: [show references]