This week's book giveaway is in the General Computing forum.
We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes byte array and chars. Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "byte array and chars." Watch "byte array and chars." New topic
Author

byte array and chars.

Asaf Karass
Greenhorn

Joined: Mar 08, 2001
Posts: 14
Hello All!
I would like to check whether a byte[i] equals is a 'A'.
can this be done? if not - can I cast the byte array into a char?
thank you,
Asaf.
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9033
    
  10
You can check whether a byte equals an 'A' by casting the byte[i] (but not the byte array) into a char:
(char)byte[i] == 'A'
[I]OR
by casting the char into a byte:
byte[i] == (byte)'A'

JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: byte array and chars.
 
Similar Threads
BufferedImage from byte[]
Xml Element to Byte Array
CORBA help!!!!!!!
how to send a byte array
byte array to inputstream