How to convert decimal to binary?

I would like to convert a decimal number into a binary number and return that binary number. However, I need to be able to represent this binary number as one whole `int` variable. The examples and past questions I've seen only returns 0's and 1's separately, which won't work. Right now, the way I'm doing it I'm storing the 0's and 1's in an `int` array. Is there any way to get all these array elements and form one `int` variable? Or is there another, better way? I'm trying to make as few java library calls as possible (ie few parseInt(), etc.)
Possible duplicate of stackoverflow.com/questions/5203974/…

以上就是How to convert decimal to binary?的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JavaScript 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准

联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏