HEX2STR

Ads

 
 

Share on Google+Share on Google+

prameela chowdary
HEX2STR
1 Answer(s)      9 years ago
Posted in : Java Beginners
Ads
View Answers

May 20, 2008 at 4:45 PM


hi


this code convert into String to hexa

import java.io.*;
import java.io.IOException.*;

public class StringToHexa{

public static void main(String args[])throws IOException{

System.out.println("This program convert string to Hexa");

BufferedReader buff = new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter string value!");
String st = buff.readLine();
for(int i = 0; i<st.length(); i++){
System.out.println();
int ch=(int)st.charAt(i);
String str="00"+Integer.toHexString(ch);
System.out.println("Place of " + i + " output is: " + str + ".");
}
}
}


This code convert into Hexa to string

import java.io.*;

public class HexaToString{

public static void main(String args[])throws IOException{

System.out.println("This program convert string to Hexa");

BufferedReader buff = new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter string value!");
String st = buff.readLine();
String s = new Integer(st).toString();
System.out.println("String value is : " + s);
}
}


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

Read for more information.

http://www.roseindia.net/java/java-conversion/


Ads









Related Tutorials/Questions & Answers:
HEX2STR - Java Beginners
HEX2STR  hai anybody help me I am fresher in java. How to convert string to hex and hex to string. In this we have to take two text boxes one for string and one for hex when we give string value in one text box it will show

Ads

 
Advertisement null

Ads