code: public String sha256Hex(String str) {
          byte[] a = DigestUtils.sha256(str);
          StringBuilder sb = new StringBuilder(a.length * 2);
          for(byte b: a)
              sb.append(String.format("%02x", b));
          return sb.toString();
      }
docs: Hex encodes sha256 output for android support.
  @return Hex encoded String.
  @param str is the String that has to be encrypted.