Using Arrays.toString will build a String like [ <cell0>, <cell1>, <cell2>, ..., <celln>] as explain in the doc :
Returns a string representation of the contents of the specified array. The string representation consists of a list of the array's elements, enclosed in square brackets ("[]"). Adjacent elements are separated by the characters ", " (a comma followed by a space). Elements are converted to strings as by String.valueOf(char). Returns "null" if a is null.
This explains why you get "[., -]" But you can correct String representation of a char[] with the constructor
public String(char[] value)
Allocates a new String so that it represents the sequence of characters currently contained in the character array argument [...]
Or the static method valueOf
public static String valueOf(char[] data)
Returns the string representation of the char array argument [...]
String s1 = new String(Arrays.copyOfRange(s,0,2));
String s2 = String.valueOf(Arrays.copyOfRange(s,0,2));
Arrays.toString((Arrays.copyOfRange(a,0,2))).replaceAll("\\s+|\\[|\\]|,", "");. Here we simply remove the characters we don't want that the Arrays.toString() method produces with the String.replaceAll() method utilizing a Regular Expression. The regular expression is basically saying replace all whitespaces (\\s+) if encountered or replace all open square brackets (\\[) if encountered or replace all close square brackets (\\]) if encountered or replace all commas (,) if encountered and replace them with a null string (nothing).