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

12
LINES

< > BotCompany Repo | #1035673 // toByte

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

Libraryless. Click here for Pure Java version (9605L/54K).

1  
static byte toByte(O o) {
2  
  if (o == null) ret (byte) 0;
3  
  if (o cast Number)
4  
    ret o.byteValue();
5  
  if (o cast S)
6  
    ret toByte(parseInt(o));
7  
  throw fail("not convertible to byte: " + getClassName(o));
8  
}
9  
10  
static byte toByte(int i) {
11  
  ret (byte) i;
12  
}

Author comment

Began life as a copy of #1025075

download  show line numbers  debug dex  old transpilations   

Travelled to 2 computer(s): elmgxqgtpvxh, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1035673
Snippet name: toByte
Eternal ID of this version: #1035673/4
Text MD5: ad149deaa6e1daa9ce1cdb0a46b71728
Transpilation MD5: 263cdca2e3a3fb1fae73ba144db960a2
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-07-03 01:16:24
Source code size: 266 bytes / 12 lines
Pitched / IR pitched: No / No
Views / Downloads: 116 / 160
Version history: 3 change(s)
Referenced in: [show references]