Home | Ajax | BioInformatics | Dojo | EAI | EJB | Hibernate | J2ME | Java | Java Glossary | Java Servlets | JavaScript | Jboss | JDBC | JDO | Jmeter | JSF | JSP | JUnit | Maven | MySQL | Spring Framework | SQL | Struts | Technology | WAP | Web Services | XML


 
  
 
Programming Tutorials: Ajax | Articles | JSP | Bioinformatics | Database | Free Books | Hibernate | J2EE | J2ME | Java | JavaScript | JDBC | JMS | Linux | MS Technology | PHP | RMI | Web-Services | Servlets | Struts | UML
 

 
Facing Programming Problem?
Ask Questions?, Browse Latest Questions, Question-Answer Guidelines
Java
  JDO Tutorials
  EAI Articles
  Struts Tutorials
  Java Tutorials
  Java Certification
  Java Applet
Questions
Comments

Convert Hexadecimal into Binary and Long

                         

In this section, you will learn to convert the hexadecimal data into the binary and long format. The java.lang package provides the functionality to convert a hexadecimal to binary and long type data. 

Code Description:

This program helps you in converting the hexadecimal data into the binary and long. At run time this program asks for a  a hexadecimal data and it then converts it into an integer type data. The toBinaryString() method converts an integer data into binary data. And the parseLong() method converts the hexadecimal data into a long type data.

Here is the code of this program:

import java.io.*;
import java.lang.*;

public class HexadecimalToBinaryAndLong{
  public static void main(String[] argsthrows IOException{
    BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
    System.out.println("Enter the hexa value!");
    String hex = bf.readLine();
    int i = Integer.parseInt(hex);
    String by = Integer.toBinaryString(i);
    System.out.println("This is Binary: " + by);
    long num = Long.parseLong(hex,16);
    System.out.println("This is long:=" + num);
  }

Download this program:

Output of this program.

C:\vinod\convert>javac HexadecimalToBinaryAndLong.java

C:\vinod\convert>java HexadecimalToBinaryAndLong
Enter the hexa value!
14
This is Binary: 1110
This is long:=20

                         

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

Audio Version
Reload Image
 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 

Current Comments

3 comments so far (
post your own) View All Comments Latest 10 Comments:

i want to learn more about java programming.

Posted by carlofano on Wednesday, 10.15.08 @ 10:12am | #81089

This program is good, but i have problem to convert long type data into hexadecimal, if anyone know please send me the information. Thanks

Posted by Supriyanto on Monday, 08.11.08 @ 06:24am | #72190

my problem is little bit different.My input system is 47:20:57:EF:EE:31
and out put pattren is reverse of actual binary out put 11100010 ...................

Posted by Md.Rafiqul Islam on Tuesday, 08.7.07 @ 11:09am | #22834

Latest Searches:
Photoshop Color Colori
<c:if
Passing Parameters in
width
ASP EXAMPLE and 1=2
Photoshop Text Effects
Get Image
MULTIPLE SELECT COMBO
dojo debug
call ejb j2ee5
count row in resultset
JSF tree collapse
spring MVC application
strating a thread in j
jar entry
objective
set colors to Jtree
Java Database Related
*copyvalueof
DOWNLOAD JAVA HOME DIR
flex
count the number of di
java nodequeue tutoria
myfaces tomahawk
java date compare exam
Developing JSP files
read hexadecimal from
free source jsp n serv
struts.
string length using if
for loop tutorial
frame in html
xml stream
Date Examples java
Hibernate Tools Update
secure
String to array in jav
coldfusion tutorials
hibernate connection p
Update in jsp
dynamic array value
c:out in var of c:fore
paypal
logic
Photoshop Effects Grun
redirecting jsp
mandatory
jpanel
count
string conceptsring ma
convert object into in
javapdfs
PHP User Authenticatio
Merge Sort In Java
access modifiers
<html:submit/>
multiple submit button
how to modify table da
Rename the File or Dir
jazn login module
sort compareTo
how to run ruby applic
Photoshop Basics Round
groovy
deleting record from d
parseInt
beehive
jsp,login
java deployment
activate email account
Cinema 4D Plugins Mete
HOW TO INSERT VALUE FO
Hash Function in Java
getting integer input
Websphere portal 6.0
pega
calculate mode in Java
sum of numbers by grou
count the numbet of di
html code for developi
Java String toLowerCase Example
Java String toCharArray Example
Java String substring Example
Java String indexOf Example
Java String startsWith Example
Java String hashCode Example
Java String matches Example
Java String length Example
Java String lastIndexOf Example
Java String isEmpty Example
Java String equalsIgnoreCase Example
Java String equals Example
Java String endsWith Example
Java String copyValueOf Example
Java String contentEquals Example
  EAI Articles
  Java Certification
Tell A Friend
Your Friend Name
Search Tutorials

 

 
 
Browse all Java Tutorials
Java JSP Struts Servlets Hibernate XML
Ajax JDBC EJB MySQL JavaScript JSF
Maven2 Tutorial JEE5 Tutorial Java Threading Tutorial Photoshop Tutorials Linux Technology
Technology Revolutions Eclipse Spring Tutorial Bioinformatics Tutorials Tools SQL
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Indian Software Development Company | iPhone Development Company in India | Java Training Delhi | Java Training at Noida |

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2008. All rights reserved.