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

19
LINES

< > BotCompany Repo | #1033223 // byteArrayToIntList_littleEndian

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

Libraryless. Click here for Pure Java version (4061L/23K).

static L<Int> byteArrayToIntList_littleEndian(byte[] a) {
  if (a == null) null;
  int n = (a.length+3)/4;
  
  ret new RandomAccessAbstractList<Int>() {
    public int size() { ret n; }
    
    public Int get(int i) {
      ret intFromBytes_littleEndian_partial(a, i*4);
    }
    
    public Int set(int i, Int val) {
      Int old = get(i);
      if ((int) old != (int) val)
        intToBytes_inArray_littleEndian_partial(val, a, i*4);
      ret old;
    }
  };
}

Author comment

Began life as a copy of #1033132

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1033223
Snippet name: byteArrayToIntList_littleEndian
Eternal ID of this version: #1033223/3
Text MD5: 84e01f7c18aff1bb700efa6351a67099
Transpilation MD5: acd9f64692e3385c3025900fe6d3dab9
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-10-16 05:56:01
Source code size: 486 bytes / 19 lines
Pitched / IR pitched: No / No
Views / Downloads: 85 / 128
Version history: 2 change(s)
Referenced in: [show references]