byte[] to a string of octals \081\037....

R

RVic

If I have a byte array, how can I convert this to a string of octals
values? Thanks, RVince
 
R

Roedy Green

If I have a byte array, how can I convert this to a string of octals
values? Thanks, RVince

Presumably if you knew how to convert a byte to a string containing an
octal representation, you could put it in a loop, with a StringBuilder
to accumulate the results and be done.

See http://mindprod.com/applet/converter.html
for how to convert byte to string radix 8

see http://mindprod.com/jgloss/stringbuilder.html
--
Roedy Green Canadian Mind Products
http://mindprod.com

"Many people tend to look at programming styles and languages like religions: if you belong to one, you cannot belong to others. But this analogy is another fallacy."
~ Niklaus Wirth (born: 1934-02-15 age: 75)
 
R

Roedy Green

See http://mindprod.com/applet/converter.html
for how to convert byte to string radix 8

hint: you probably want unsigned rather that signed bytes. Signed
bytes are rarely used in Java.
--
Roedy Green Canadian Mind Products
http://mindprod.com

"Many people tend to look at programming styles and languages like religions: if you belong to one, you cannot belong to others. But this analogy is another fallacy."
~ Niklaus Wirth (born: 1934-02-15 age: 75)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,066
Latest member
VytoKetoReviews

Latest Threads

Top