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

13
LINES

< > BotCompany Repo | #1002621 - toInt

JavaX fragment (include)

static int toInt(O o) {
  if (o == null) ret 0;
  if (o instanceof Number)
    ret ((Number) o).intValue();
  if (o instanceof S)
    ret parseInt((S) o);
  throw fail("woot not int: " + getClassName(o));
}

static int toInt(long l) {
  if (l != (int) l) fail("Too large for int: " + l);
  ret (int) l;
}

download  show line numbers  debug dex   

Travelled to 13 computer(s): aoiabmzegqzx, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, sawdedvomwva, tslmcundralx, tvejysmllsmz, whxojlpjdney

No comments. add comment

Snippet ID: #1002621
Snippet name: toInt
Eternal ID of this version: #1002621/1
Text MD5: d1a373e35489f84025a66f5b84ec9841
Author: stefan
Category: javax / eleu
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-08-15 17:48:22
Source code size: 316 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 423 / 1143
Referenced in: [show references]