Is it possible to initialize a String from an array of hex values, like C style?
unsigned char[] charArray = {0x41, 0x42, 0x43};
Why is not possible to do something like this?
String charArray = new String((byte[]) {0x41, 0x42, 0x43});
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.
It is perfectly possible, you can do it in several ways.
Using unicode escapes:
Creating and using a byte array:
The main thing you have to remember is that the string is not an array of something, it is a separate object. Therefore it should either be created as a string literal, or with one of the constructors.