エントリーの編集
エントリーの編集は全ユーザーに共通の機能です。
必ずガイドラインを一読の上ご利用ください。
How to get 0-padded binary representation of an integer in java?
記事へのコメント0件
- 注目コメント
- 新着コメント
このエントリーにコメントしてみましょう。
注目コメント算出アルゴリズムの一部にLINEヤフー株式会社の「建設的コメント順位付けモデルAPI」を使用しています
- バナー広告なし
- ミュート機能あり
- ダークモード搭載
関連記事
How to get 0-padded binary representation of an integer in java?
for example, for 1, 2, 128, 256 the output can be (16 digits): 0000000000000001 0000000000000010 ... for example, for 1, 2, 128, 256 the output can be (16 digits): 0000000000000001 0000000000000010 0000000010000000 0000000100000000 I tried String.format("%16s", Integer.toBinaryString(1)); it puts spaces for left-padding: ` 1' How to put 0s for padding. I couldn't find it in Formatter. Is there another way to do it? P.S. this post describes how to format integers with left 0-padding, but it is not