code: public static void hash(byte[] data, byte[] output) {
      int len = output.length;
      if (len == 0)
        return;
      int[] code = calculate(data);
      for (int outIndex = 0, codeIndex = 0, shift = 24;
              outIndex < len && codeIndex < 5;
                  ++outIndex, shift -= 8) {
        output[outIndex] = (byte) (code[codeIndex] >>> shift);
        if (shift == 0) {
          shift = 32;     // will be decremented by 8 before next iteration
          ++codeIndex;
        }
      }
    }
docs: Calculates the SHA-1 hash code of the input data and writes up to
  20 bytes of it in the output byte array parameter.
  
  @param data the byte array to be hashed
  @param output output parameter for the calculated hash code