Solved

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

Posted on 2002-03-21
1
1,062 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 9

Accepted Solution

by:
Venci75 earned 300 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…

617 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