Solved

Convert Java String into a Byte Array

Posted on 2006-11-02
3
1,439 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
[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
  • 2
3 Comments
 
LVL 86

Accepted Solution

by:
CEHJ earned 400 total points
ID: 17859457
0
 
LVL 27

Assisted Solution

by:rrz
rrz earned 100 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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Java Restore security prompts not working 10 254
jmss example java 2 48
Bot application - advice 3 80
Eclipse for Java EE development 2 68
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
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.
Suggested Courses

734 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