Javascript:
const password = "TestPw";
password
.split('')
.map(letter => letter.charCodeAt()
.toString(2)
)
.join(' ');
Java:(I copied this code, I'm not sure about this)
public static String toText(String info)throws UnsupportedEncodingException{
byte[] encoded = info.getBytes();
String text = new String(encoded, "UTF-8");
System.out.println("print: "+text);
return text;
}