Tuesday, April 30, 2013

Convert Decimal into Binary in Java


Converting decimal to binary in Java



import java.lang.*;
import java.io.*;
public class DecimalToBinary{
  public static void main(String args[]) throws IOException{
  BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
  System.out.println("Enter the decimal value:");
  String hex = bf.readLine();
  int i = Integer.parseInt(hex);  
  String by = Integer.toBinaryString(i);
  System.out.println("Binary: " + by);
  }
}  


run:
Enter the decimal value:
10
Binary: 1010
BUILD SUCCESSFUL (total time: 9 seconds)

Other Way :


public class NumberConverter {
   public static void main(String[] args) {
       int i = Integer.parseInt(args[0]);
       toBinary(i);
   }

   public static void toBinary(int int1){
       System.out.println(int1 + " in binary is");
       System.out.println(Integer.toBinaryString(int1));
   }
}

-----------------------------------------------------

syntax - Converting decimal to binary in Java 
java - How to convert binary string value to decimal -
Converting Decimal to Binary Java 
java - Decimal-to-binary conversion
Java Program Convert Decimal To Binary
How to convert decimal to binary, octal and hex String in Java Program
Decimal To Binary Converter - Java Tutorials 
Negative decimal to binary - General Programming
decimal to binary number - Java Tutorials - Codecall
Convert Binary Integer to Decimal - Java Help
Searches related to java Convert Decimal into Binary
convert decimal number into binary
convert hexadecimal into binary
convert decimal into hexadecimal
convert fraction into binary
convert binary into octal
how to convert from base 10 to binary
binary converter to number
converting binary decimal calculator
how to convert decimal to binary - Java
Convert decimal value to binary 

IT Certification Category (English)640x480

Partner Sites

VideoToGifs.com

EasyOnlineConverter.com

SqliteTutorials.com


Top Online Courses From ProgrammingKnowledge

Python Course http://bit.ly/2vsuMaS
Java Coursehttp://bit.ly/2GEfQMf
Bash Coursehttp://bit.ly/2DBVF0C
Linux Coursehttp://bit.ly/2IXuil0
C Course http://bit.ly/2GQCiD1
C++ Coursehttp://bit.ly/2V4oEVJ
PHP Coursehttp://bit.ly/2XP71WH
Android Coursehttp://bit.ly/2UHih5H
C# Coursehttp://bit.ly/2Vr7HEl
JavaFx Coursehttp://bit.ly/2XMvZWA
NodeJs Coursehttp://bit.ly/2GPg7gA
Jenkins Course http://bit.ly/2Wd4l4W
Scala Coursehttp://bit.ly/2PysyA4
Bootstrap Coursehttp://bit.ly/2DFQ2yC
MongoDB Coursehttp://bit.ly/2LaCJfP
QT C++ GUI Coursehttp://bit.ly/2vwqHSZ