Solved

Convert Java String into a Byte Array

Posted on 2006-11-02
3
1,434 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 400 total points
Comment Utility
0
 
LVL 27

Assisted Solution

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

Expert Comment

by:CEHJ
Comment Utility
:-)
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

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…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
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.

728 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now