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>
<syntaxhighlight lang="java">public class Main {
The <code>Integer</code> class offers the <code>toBinaryString</code> method.
public static void main(String[] args) {
</p>
System.out.println(Integer.toBinaryString(5));
<syntaxhighlight lang="java">
System.out.println(Integer.toBinaryString(50));
System.out.println(Integer.toBinaryString(9000));
Integer.toBinaryString(5);
</syntaxhighlight>
}
}</syntaxhighlight>
<syntaxhighlight lang="java">
Integer.toBinaryString(50);
{{out}}
</syntaxhighlight>
<pre>101
<syntaxhighlight lang="java">
Integer.toBinaryString(9000);
</syntaxhighlight>
<p>
If you printed these values you would get the following.
</p>
<pre>
101
110010
110010
10001100101000</pre>
10001100101000
</pre>

=={{header|JavaScript}}==
=={{header|JavaScript}}==
===ES5===
===ES5===