byte abc[]="204.29.207.217";
This is giving an error. Please, tell me correct the method.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you’re trying to assign hard-coded values, you can use:
Note the cast because Java bytes are signed – the cast here will basically force the overflow to a negative value, which is probably what you want.
If you’re actually trying to parse a string, you need to do that – split the string into parts and parse each one.
If you’re trying to convert a string into its binary representation under some particular encoding, you should use
String.getBytes, e.g.(Note that conventionally the
[]is put as part of the type of the variable, not after the variable name. While the latter is allowed, it’s discouraged as a matter of style.)