Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How to convert 8 bit binary string to decimal or integer or ASCII code

Posted on 2002-03-21
1
Medium Priority
?
1,070 Views
Last Modified: 2012-08-14
How to convert 8 bit binary string to ASCII code.
what i want something like this

01010011 01100101 01100011 01110010 01100101 01110100 00100001

convert it of this to ascii code
0
Comment
Question by:dxding
1 Comment
 
LVL 9

Accepted Solution

by:
Venci75 earned 1200 total points
ID: 6885922
try this:
String src = "01010011 01100101 01100011 01110010 01100101 01110100 00100001";
java.util.StringTokenizer tok = new java.util.StringTokenizer(src, " ");
StringBuffer res = new StringBuffer();
while (tok.hasMoreTokens()) {
    char c = (char) Integer.parseInt(tok.nextToken(), 2);
    res.append(c);
}
System.out.println(res.toString());
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Suggested Courses

783 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question