in samplecode/ue-ra/ue-ra-client-java/src/main/java/org/rustsgx/ueraclientjava/CommonUtils.java [55:74]
public static void printCert(byte[] rawByte) {
System.out.print("---received-server cert: [Certificate(b\"");
for (int i = 0; i < rawByte.length; i++) {
char c = (char) (Byte.toUnsignedInt(rawByte[i]));
if (c == '\n') {
System.out.print("\\n");
} else if (c == '\r') {
System.out.print("\\r");
} else if (c == '\t') {
System.out.print("\\t");
} else if (c == '\\' || c == '"') {
System.out.printf("\\%c", c);
} else if (Byte.toUnsignedInt(rawByte[i]) >= 32 && Byte.toUnsignedInt(rawByte[i]) < 127) {
System.out.printf("%c", c);
} else {
System.out.printf("\\x%02x", rawByte[i]);
}
}
System.out.println("\")]");
}