I have the following String which is stored in a text file and also as a variable in Java : ‘destructive’
My code below
public class SimpleTest {
public static void main(String[] args) {
try {
File file = new File("TestFIle.txt");
byte[] file_encoded = FileUtils.readFileToString(file, "UTF-8").getBytes("UTF-8");
System.out.println(Arrays.toString(file_encoded));
String toEncrypt = "‘destructive’";
byte[] encoded = toEncrypt.getBytes(Charset.forName("UTF-8"));
System.out.println(Arrays.toString(encoded));
} catch (IOException ex) {
Logger.getLogger(SimpleTest.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
As you can see
String toEncrypt = "‘destructive’";
The contents in TestFIle.txt is also : ‘destructive’
When i run the code i get:
[-17, -69, -65, -30, -128, -104, 100, 101, 115, 116, 114, 117, 99, 116, 105, 118, 101, -30, -128, -103]
[-30, -128, -104, 100, 101, 115, 116, 114, 117, 99, 116, 105, 118, 101, -30, -128, -103]
What is the additional [-17, -69, -65] at the starting of byte array while reading the same text from a file and why do i get that?