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

10
LINES

< > BotCompany Repo | #1029057 // roundUpToPowerOfTen [smallest power of 10 is 1]

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

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

static long roundUpToPowerOfTen(int i) {
  ret i <= 1000000
    ? i <= 1000
      ? i <= 1 ? 1 : i <= 10 ? 10 : i <= 100 ? 100 : 1000
      : i <= 10000 ? 10000 : i <= 100000 ? 100000 : 1000000
    : i <= 1000000000
      ? i <= 10000000 ? 10000000 : i <= 100000000 ? 100000000
      : 1000000000
    : 10000000000;
}

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1029057
Snippet name: roundUpToPowerOfTen [smallest power of 10 is 1]
Eternal ID of this version: #1029057/4
Text MD5: 7cadcceaafe65733f91a3a069804a394
Transpilation MD5: 1497fec9e6a1ea108e081a9403865a2e
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-07-18 18:39:44
Source code size: 326 bytes / 10 lines
Pitched / IR pitched: No / No
Views / Downloads: 226 / 303
Version history: 3 change(s)
Referenced in: [show references]