I need to compare a byte to a null value for a program I am writing, in order to catch these values to stop them being printed in an output file as "<nul>".
At first, I tried
for (int i=1; i<=127; i++)
if (AwaitData.received[i] == null)
but this gives the error:
StoreData.java:14: incomparable types: byte and <nulltype>
I then tried the idea of making a Byte and setting its value to null:
Byte NULL = null;
But this doesn't work either, giving a null pointer exception when I run the for loop:
Exception in thread "main" java.lang.NullPointerException
at StoreData.doIt(StoreData.java:14)
Is there any way of actually doing this?
Thanks.