Binary digits: Difference between revisions
Content added Content deleted
Line 2,795: | Line 2,795: | ||
I am using implicit output. |
I am using implicit output. |
||
=={{header|Java}}== |
=={{header|Java}}== |
||
<p> |
|||
⚫ | |||
The <code>Integer</code> class offers the <code>toBinaryString</code> method. |
|||
public static void main(String[] args) { |
|||
</p> |
|||
⚫ | |||
⚫ | |||
⚫ | |||
Integer.toBinaryString(5); |
|||
</syntaxhighlight> |
|||
} |
|||
<syntaxhighlight lang="java"> |
|||
⚫ | |||
{{out}} |
|||
</syntaxhighlight> |
|||
⚫ | |||
<syntaxhighlight lang="java"> |
|||
⚫ | |||
</syntaxhighlight> |
|||
<p> |
|||
If you printed these values you would get the following. |
|||
</p> |
|||
⚫ | |||
101 |
|||
110010 |
110010 |
||
10001100101000 |
10001100101000 |
||
</pre> |
|||
=={{header|JavaScript}}== |
=={{header|JavaScript}}== |
||
===ES5=== |
===ES5=== |