Latest Tutorials| Questions and Answers|Ask Questions?|Site Map




Have Programming Question? Ask it here!
 
 
 


prameela chowdary
HEX2STR
1 Answer(s)      6 years and 4 months ago
Posted in : Java Beginners



Advertisement
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/



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
Advertisements
 

 

 

DMCA.com