When translating an array into a string
String str3="20150"; byte[] b3=str3.getBytes(); System.out.println(b3); //Массив байтов переводим обратно в строку try{ String s=new String(b3,"[B@15db9742"); System.out.println(s); }catch (UnsupportedEncodingException e){ e.printStackTrace(); message is issued
Exception in thread "java.lang.Error: Unresolved compilation problem: UnsupportedEncodingException cannot be resolved to a type
How to fix this problem?
[B@15db9742strange argument. TryCharset.defaultCharset()instead - Herrgottjava.io.UnsupportedEncodingExceptionclass. But you are doing something strange, starting from array output (toString()on arrays displays such nonsense (type @ hashcode instance) as you do, so you should callArrays.toString(b3)to get a human readable string). Also,getBytes()is used to get the byte representation of the string using the specified encoding (or the default encoding, as you have). In general, it would be better if you tell why you wrote it all. - zRrr