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).

static byte toByte(O o) {
  if (o == null) ret (byte) 0;
  if (o cast Number)
    ret o.byteValue();
  if (o cast S)
    ret toByte(parseInt(o));
  throw fail("not convertible to byte: " + getClassName(o));
}

static byte toByte(int i) {
  ret (byte) i;
}

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: 74 / 104
Version history: 3 change(s)
Referenced in: [show references]