conversion from decimal to hexadecimal and vice versa

conversion from decimal to hexadecimal and vice versa

can i get the code for converting decimal to hexadecimal

View Answers

September 12, 2012 at 5:06 PM

Here is a code that converts decimal to hexadecimal.

 import java.io.*;

public class DecimalToHexadecimal{
  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 hex1 = Integer.toHexString(i);
  System.out.println("Hexa decimal: " + hex1);
  }
}

Here is a code that converts hexadecimal to decimal.

 import java.io.*;

public class  HexadecimalToDecimal{
  public static void main(String[] args) throws IOException{
  BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
  System.out.println("Enter the Hexadecimal number:");
  String str= bf.readLine();
  int i= Integer.parseInt(str,16);
  System.out.println("Decimal:="+ i);
  }
}

September 12, 2012 at 6:50 PM

thank yoy sir.can i get the code without using standard libraries

Ads









Related Tutorials/Questions & Answers:
conversion from decimal to hexadecimal and vice versa
conversion from decimal to hexadecimal and vice versa  can i get the code for converting decimal to hexadecimal   Here is a code that converts decimal to hexadecimal. import java.io.*; public class
decimal to hexadecimal
decimal to hexadecimal  using array in java convert decimal to hexadecimal.   Hi, Please see the example Convert Decimal to Hexadecimal. Thanks
Advertisements
Convert Hexadecimal to Decimal
Convert Hexadecimal to Decimal     ... a hexadecimal number into decimal. Code Description: This program takes a hexadecimal...: hexadecimal and 16. It converts a hexadecimal number into a decimal number. 
Convert Decimal to Hexadecimal
Convert Decimal to Hexadecimal     ... into hexadecimal. The java.lang package provides the functionality to convert a decimal... a decimal number at console and converts it  into the hexadecimal format using
Convert a file name path to url and vice versa in java
Overview of Networking through JAVA,To retrieve the IP address from Host Name, vice-versa
To retrieve the IP address from Host Name, vice-versa... to explain the method to find out the IP address from host name and to vice verse. Here... the host name of that Host. Apart from all of this we put the condition for wrong
how to convert all the pixel value to hexadecimal and from hexadecimal to binary in vb.net
how to convert all the pixel value to hexadecimal and from hexadecimal... is not available so that i selected as java.first i need to store the pixels in 2d array .from that i need to convert all the pixel values into hexadecimal how it can be done
Conversion of Decimal to Binary in Java
Conversion of Decimal to Binary  in Java In this section we will discuss about conversion of Decimal to Binary in Java. You know that number having base 10 is a decimal number, for example 10 is a decimal number which can
Data Conversion from int to another type
Data conversion is the conversion of data from one type to another type. In this section we will learn about data conversion from int primitive type to another data type like String, boolean and char etc
Data Conversion from String to another type
Data conversion is the conversion of data from one type to another type. In this section we will learn about data conversion from String primitive type to another data type like int, boolean and char etc
Data Conversion from short to another type
Data conversion is the conversion of data from one type to another type. In this section we will learn about data conversion from short primitive type to another data type like String, boolean and char etc
Data Conversion from byte to another type
Data conversion is the conversion of data from one type to another type. In this section we will learn about data conversion from byte primitive type to another data type like String, boolean and char etc
Data Conversion from float to another type
Data conversion is the conversion of data from one type to another type. In this section we will learn about data conversion from float primitive type to another data type like String, boolean and char etc
Data Conversion from double to another type
Data conversion is the conversion of data from one type to another type. In this section we will learn about data conversion from double primitive type to another data type like String, boolean and char etc
Data Conversion from long to another type
Data conversion is the conversion of data from one type to another type. In this section we will learn about data conversion from long primitive type to another data type like String, boolean and char etc
Convert Byte to Hexadecimal
into a hexadecimal number. The package java.lang provides the functionality for this conversion. Code Description: This program takes a byte number from console... Convert Byte to Hexadecimal     
To retrieve the IP address from Host Name, vice-versac
To retrieve the IP address from Host Name, vice-versa... to explain the method to find out the IP address from host name and to vice verse. Here... the host name of that Host. Apart from all of this we put the condition for wrong
Extracting the audio from video without conversion
the example of extracting the audio from video without conversion. Thanks   Hi... use for Extracting the audio from video without conversion: ffmpeg -i...Extracting the audio from video without conversion  Hi, I have
language conversion from english to arabic in a struts project
language conversion from english to arabic in a struts project  how to convert struts project to arabic language from english language without using... also into english language from arabic language   Please visit
String conversion
String conversion  I want to convert a string of mix cases(lower and upper case) to vice versa. ex. HellO should be printed to hELLo. the string comes from user using datainputstream. Also sending individual chars of string
Java Temperature Converter
temperature from Celsius to Fahrenheit and vice versa. Here is an example where.... It prints the chart in tabular format and shows the conversion of the Fahrenheit equivalents of all Celsius temperatures from 0 to 100 degrees in 4 degree
Conversion from string data type into different data types.
Conversion from string data type into different data types.  string str="World id Beutifull"; char chr[20]; char* chrctr ; Qustion is -How to store the 'str' value in 'chr' and 'chrctr'? int abc; sprintf(abc ,"%s",str
Convert Binary to Hexadecimal
Convert Binary to Hexadecimal     ... into hexadecimal.  The java.lang package provides the functionality to convert the binary data into hexadecimal.  Description of the program: This program takes
ModuleNotFoundError: No module named 'versa'
ModuleNotFoundError: No module named 'versa'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'versa' How to remove the ModuleNotFoundError: No module named 'versa'
PHP SQL Connection
; PHP SQL Connection is used to access and return the records from PHP and MySQL database and vice-versa. Understand with Example The Tutorial illustrate...); php_sql_fetch.php: To access the data from table 'stu' firstly we need to include
RMI-Example-3
RMI-Example-3       In this example you will see function calls from client to server and vice versa. This application for running requires a Remote Machine. 
ModuleNotFoundError: No module named 'hexadecimal'
ModuleNotFoundError: No module named 'hexadecimal'  Hi, My Python... 'hexadecimal' How to remove the ModuleNotFoundError: No module named 'hexadecimal' error? Thanks   Hi, In your python environment
Convert integer type data into binary, octal and hexadecimal
conversion example! Integer: 50 Byte: 110010 Hexa decimal: 32... Convert integer type data into binary, octal and hexadecimal... will learn how to convert an integer type data into binary, octal and hexadecimal
Hexadecimal numbers multiplication
Hexadecimal numbers multiplication  Sir, I have to multiply 128 bit hexadecimal numbers. Do u have any logic for this?? The numbers are like ab7564fa342b5412c34d9e67ab341b58
Hibernate Annotations
a metadata to govern the transformation of data from POJO to database tables and vice versa. Most commonly XML file is used to write the metadata information... will use the "employee" table from the database. The SQL query to create
SQL Decimal
an example from 'SQL Decimal'. To understand and grasp the example we create... SQL Decimal       SQL Decimal is used to specify the values in decimal datatype. The Decimal datatype

Ads