Java program to convert integer value into binary

import java.util.*;
import java.util.Scanner;
public class IntegerToBinary
{
   public static void main(String[] args)
   {
      int num;
      String str = "";
      Scanner sc = new Scanner(System.in);
      System.out.println("Please enter the a number : ");
      num = sc.nextInt();
      // convert int to binary java
      while(num > 0)
      {
         int y = num % 2;
         str = y + str;
         num = num / 2;
      }
      System.out.println("The binary conversion is : " + str);
      sc.close();
   }
}

4.8
5
Boehmi 120 points

                                    Integer.toString(100,8) // prints 144 --octal representation

Integer.toString(100,2) // prints 1100100 --binary representation

Integer.toString(100,16) //prints 64 --Hex representation

4.8 (5 Votes)
0
3.9
10

                                    Integer.toBinaryString(int i)

3.9 (10 Votes)
0
4
6
DeWolf 115 points

                                    public static String makeBinaryString(int n) {
	StringBuilder sb = new StringBuilder();
	while (n > 0) {
    sb.append(n % 2);
		n /= 2;
	}
  	sb.reverse();  	
  	return sb.toString();
}

4 (6 Votes)
0
Are there any code examples left?
Create a Free Account
Unlock the power of data and AI by diving into Python, ChatGPT, SQL, Power BI, and beyond.
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Relative searches
conversion of a number to its binary java function string decimal to binary in java converting decimal to binary in java to binary in java number with decimal to binary in java integer to binary string java java convert number to binary how to convert number into binary in java java decimal to binary number java converting positve integer into binary number how to convert integer into binary in java java integer to binary string doc java integer to binary string integer to binary in java binary string to binary int java convert from decimal to binary java java int to binary array int to binary string of 32 bit java convert int to binary string how to convert decimal into binary in java decimal to binary in math.lang java converting int to binary in java wap to convert decimal to binary in java program to convert integer to binary how to convert a no into binary in java java number to binary given a number convert it into binary using java decimal to binary java code how to find the integer to binary conversion of 15 in java how to convert a number to binary in java how to convert a no into binary java how to convert int to binary in java java program to find decimal to binary java convert int to binary how to convert a digit into binary java decimal to binary conversion program java java how to convert a number in to a binary num program to convert an integer to its binary. convert number to binary java conver number to binary java convert a no into binary in java how to store binary number in java by input convert a decimal number to binary in java int to binary java converter decimal to binary in four bit java decimal to binary converter in java java bytes to binary java convert integer to binary string java from int to binary Write a Java program to convert a binary number to a decimal number how to store binary number in int java java library to convert integer to binary turning binary string into binary number java what method is used to convert numbers to binary convert number into its binary equivalent in java decimal to binary java program binary int to binary string java convert decimal to binary java how to convert a number from long to binary in java convert number into binary + java convert int to binary int in java convert int to binary string convert to binary integer java convert to binary java converting int to binary java java, convert bit to binary int to binary in java converting a number to a binary number ni java convert integer into binary java integer to binary string how to convert an integer into binary how to convert the integer number into binary representation in java java convert int to binary number convert a number into its binary form in java how to convert number to binary number in java how to convert decimal to binary in java program for decimal to binary in java simple number to binary in Java java input binary number convert integer to binary java java decimal to binary conversion int to binary string in java java int to binary string how to convert number to binary string java convert an integer to binary in java convert an integer from decimal to binary in java code to make number to binary java integer to binary java method how to convert numbers to binary java int to binary string of length java java code for decimal to binary integet to binary java convert value to binary java WAP to Convert a decimal number into binary? java code to convert decimal to binary in java decimal to binary in jvaa converting int to binary java program to convert integer to binary java algorithm convert to binary numbers java program to decimal to binary converting integer to binary in java changing a number into binary in java converting a number to binary in java java convertion of decimal values to binary to binary java decimal to binary Java program to convert decimal number to binary how to convert binary string to integer in java to convert a decimal to binary number in java java convert numbers into binary Write a Java program to convert a binary number to decimal number and to decimal number to binary number string integer to binary number java convert decimal to binary using array in java Java program to convert integer value into binary number to binary converter java decimal to binary java java int to binary digits dec to binary java integer.to binary java java convert decimal to binary how to take binary number as input in java convert integer to binary in java decimal number to binary number in Java java input integer binary java conversion decimal to binary decimal to binary in java convert decimal to binary in java java to binary conversion of int to binary in java from int to binary convert int to binary in java convert int to binary java convert to binary in java how to convert integer to binary string in jav java code to convert decimal to binary how to convert no into binary in java Function to convert decimal to binary in java java convert string int to binary how to print out the bit string of an int Integer to binary java o(n) integer to binary conversion in java amount of numbers in an integer in java convert int to binary interger to binary string java print binary convert number to binary in java int to binary program to convert int to binary binary to java how to get 4 digit binary number in java binary string java Binary Numbers in java from integer to binary number to binary in java integer to binary print as binary java how to print a binary in java working on biary system in java convert number to bitwise java int to binary java java integer to binary convert an integer to binary java binarie output in java how to convert integer into binary number in java getting int binary value in java how to print binary number in java convert int to binary number bit bitwise java convert integer to binary format java how to convert an integer to a binary number in java conversion of integer to binary in java how to know if you are done calculating a number in binary java print binary string for int java any no to binat coversion in java java get bit representation of int int to binary java format convert number to bits java java find a binary number of a int java print number in binary integer to binary java how to get the binary value of a number in java java print int as binary java print integer as bits how to get binary value in java how to convert integer to binary in java how to print binary value in java print binary number in java how to store int as binary in java int to binary string java how to convert int in binary in java convert int binary java binary number input in int java show binary numbers java8 java int to binary
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source