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);

Enter the decimal value:
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]);

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


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