Use the DatatypeConverter liibrary that can be imported as:
>> import javax.xml.bind.DatatypeConverter;
And then lets say certificate.getSignature() is returning a byte array, use these commands:
>> byte[] sign = certificate.getSignature();
>> String hexasign = DatatypeConverter.printHexBinary(sign);
>> System.out.println("Signature on the Certificate: "+hexasign+"\n");
>> import javax.xml.bind.DatatypeConverter;
And then lets say certificate.getSignature() is returning a byte array, use these commands:
>> byte[] sign = certificate.getSignature();
>> String hexasign = DatatypeConverter.printHexBinary(sign);
>> System.out.println("Signature on the Certificate: "+hexasign+"\n");