如果您实际上希望将答案作为字符串(而不是字节数组)返回,则始终可以执行如下操作:String plaintext = "your text here";MessageDigest m = MessageDigest.getInstance("MD5");m.reset();m.update(plaintext.getBytes());byte[] digest = m.digest();BigInteger bigInt = new BigInteger(1,digest);String hashtext = bigInt.toString(16);// Now we need to zero pad it if you actually want the full 32 chars.while(hashtext.length() < 32 ){ hashtext = "0"+hashtext;}