I have a problem with parsers.
The problem is I get an integer such as "8" and I need to transform this to an 8-bit unsigned byte. Later on I will receive an integer "56" and need to transform it using the the same method but when I get a "-53" (for example) I shall say that was a mistake in the communication and sending.
For example,
number = 538; //or 63492873 or 8 or 17826312631 or -231 or whatever
try{
byte response[] = Parse8BitUnsigned(number);
}catch(Idkexcepcion ex){
System.out.println("the number is a signed one");
byte response[] = Parse8BitSigned(number);
}
Note: Parse8BitSigned() and Parse8BitSigned() had not been implemented. I need that method for any number