      CHARACTER*6 FUNCTION I2X(N)
C
C     .. Scalar Arguments ..
      INTEGER                  N
C     .. Local Scalars ..
      INTEGER                  I, J, K
      CHARACTER*16             XDIGIT
C     .. Intrinsic Functions ..
      INTRINSIC                ABS, MOD
C     .. Data statements ..
      DATA                     XDIGIT/'0123456789abcdef'/
C     .. Executable Statements ..
C
      I2X(1:6) = '     0'
      I = ABS(N)
      DO 20 J = 6, 1, -1
         IF (I.GT.0) THEN
            K = MOD(I,16) + 1
            I2X(J:J) = XDIGIT(K:K)
            I = I/16
         END IF
   20 CONTINUE
      RETURN
      END
