Jacky Luk wrote:I want to display the string as a UTF8 or ASCII character string.
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Matthew Brown wrote:Have a look at the constructors available in the String class - one of those will probably do what you want.
How do I skip the -112 character and return 72,101,108,108,111,0?
William Brogden wrote:Note that Java byte values run 0 to 255, values above 127 will print as negative integers so that last character is above the ascii 7 bit character set.
How do I skip the -112 character and return 72,101,108,108,111,0?
I thought you wanted a string consisting of the characters corresponding to 72,101, etc - do you really want a list of byte values as a String?
Bill
Jacky Luk wrote:I want a list of byte values as a string.
As the library I am using returns a array of bytes with a -127 character on the end. I'd like to eliminate that byte.
That byte I believe was part of the communication protocol. I want to strip that.
OCPJP
Jacky Luk wrote:
Guess what, I get a string of things like
72101108108111
OCPJP
Ishan Pandya wrote:
Jacky Luk wrote:
Guess what, I get a string of things like
72101108108111
Like what kind of output do you want now?
This would definitely help out.
OCPJP
Jacky Luk wrote:If the byte array consists of 72,101,108,108,111,-112,0
And you see this is a string "hello" with a -112 at the end
How do I skip the -112 character and return 72,101,108,108,111,0?
Jacky Luk wrote:That byte I believe was part of the communication protocol. I want to strip that.
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here