TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Data Conversion program in Java
Alagunila Meganathan
Aug 02
2016
Code
482
0
0
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
expand
DataConversion.rar
public
class
DataConversion{
public
static
void
main(String[] args) {
System.out.println(
"Data types conversion example!"
);
int
in =
50
;
System.out.println(
"Integer: "
+ in);
//integer to binary
String by = Integer.toBinaryString(in);
System.out.println(
"Byte: "
+ by);
//integer to hexadecimal
String hex = Integer.toHexString(in);
System.out.println(
"Hexa decimal: "
+ hex);
//integer to octal
String oct = Integer.toOctalString(in);
System.out.println(
"Octal: "
+ oct);
}
}
Java