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

x
?
Solved

Convert Java String into a Byte Array

Posted on 2006-11-02
3
Medium Priority
?
1,444 Views
Last Modified: 2008-02-01
Hello folks,

I have a String containing an IP address.  Ex. String ip = "192.168.10.1" and I need this turned into a byte array.

bytear[0] = 192;
bytear[1] = 168;
bytear[2] = 10;
bytear[3] = 1;

The periods in the ip address are what's getting me.  Suggestions?

Thanks
0
Comment
Question by:nothing8171
  • 2
3 Comments
 
LVL 86

Accepted Solution

by:
CEHJ earned 1600 total points
ID: 17859457
0
 
LVL 28

Assisted Solution

by:rrz
rrz earned 400 total points
ID: 17860197
>The periods in the ip address are what's getting me.  Suggestions    
String[] a = ip.split("\\.");
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 17951505
:-)
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses

886 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