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

12
LINES

< > BotCompany Repo | #1031940 // absDoubleMaxIndex

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

Libraryless. Click here for Pure Java version (44L/1K).

1  
static int absDoubleMaxIndex(double[] l, int from, int to) {
2  
  double max = -Double.MAX_VALUE;
3  
  int idx = -1;
4  
  for (int i = from; i < to; i++) {
5  
    double d = abs(l[i]);
6  
    if (d > max) {
7  
      max = d;
8  
      idx = i;
9  
    }
10  
  }
11  
  ret idx;
12  
}

Author comment

Began life as a copy of #1031939

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx

No comments. add comment

Snippet ID: #1031940
Snippet name: absDoubleMaxIndex
Eternal ID of this version: #1031940/3
Text MD5: 517ff69350b61df970c6677e42dce1a0
Transpilation MD5: 43e9b3aff8ad9dcabaee7efd411caf08
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-08-03 17:13:36
Source code size: 255 bytes / 12 lines
Pitched / IR pitched: No / No
Views / Downloads: 181 / 231
Version history: 2 change(s)
Referenced in: [show references]