// Path: fauxflake-core/src/main/java/com/github/rholder/fauxflake/api/EncodingProvider.java
// public interface EncodingProvider {
// 
//     /**
//      * Return a raw byte encoding of the given time and sequence number.
//      *
//      * @param time      a time value to encode
//      * @param sequence  a sequence value to encode
//      */
//     public byte[] encodeAsBytes(long time, int sequence);
// 
//     /**
//      * Return a Long encoding of the given the time and sequence number.
//      *
//      * @param time      a time value to encode
//      * @param sequence  a sequence value to encode
//      */
//     public long encodeAsLong(long time, int sequence);
// 
//     /**
//      * Return a String encoding of the given the time and sequence number.
//      *
//      * @param time      a time value to encode
//      * @param sequence  a sequence value to encode
//      */
//     public String encodeAsString(long time, int sequence);
// 
//     /**
//      * Return the maximum number of sequence numbers that can be encoded for a
//      * given time by this implementation.
//      */
//     public int maxSequenceNumbers();
// }
// 
// Path: fauxflake-core/src/main/java/com/github/rholder/fauxflake/util/StringUtils.java
// public static String leftPad(String str, int size) {
//     return leftPad(str, size, ' ');
// }


import com.github.rholder.fauxflake.api.EncodingProvider;
import java.nio.ByteBuffer;
import static com.github.rholder.fauxflake.util.StringUtils.leftPad;
import static java.lang.Long.toHexString;
        buffer[15] = (byte) (rest);

        return buffer;
    }

    /**
     * This always throws an {@link UnsupportedOperationException} since the
     * output of this {@link EncodingProvider} doesn't fit in 4 bytes.
     *
     * @param time     a time value to encode
     * @param sequence a sequence value to encode
     * @return never returns
     */
    @Override
    public long encodeAsLong(long time, int sequence) {
        throw new UnsupportedOperationException("Long value not supported");
    }

    /**
     * Return the 32 character left padded hex version of the given id. These
     * can be lexicographically sorted.
     *
     * @param time     a time value to encode
     * @param sequence a sequence value to encode
     * @return 32 character left padded hex version of the given id
     */
    @Override
    public String encodeAsString(long time, int sequence) {
        StringBuilder s = new StringBuilder(32);
        ByteBuffer bb = ByteBuffer.wrap(encodeAsBytes(time, sequence));
// Path: fauxflake-core/src/main/java/com/github/rholder/fauxflake/api/EncodingProvider.java
// public interface EncodingProvider {
// 
//     /**
//      * Return a raw byte encoding of the given time and sequence number.
//      *
//      * @param time      a time value to encode
//      * @param sequence  a sequence value to encode
//      */
//     public byte[] encodeAsBytes(long time, int sequence);
// 
//     /**
//      * Return a Long encoding of the given the time and sequence number.
//      *
//      * @param time      a time value to encode
//      * @param sequence  a sequence value to encode
//      */
//     public long encodeAsLong(long time, int sequence);
// 
//     /**
//      * Return a String encoding of the given the time and sequence number.
//      *
//      * @param time      a time value to encode
//      * @param sequence  a sequence value to encode
//      */
//     public String encodeAsString(long time, int sequence);
// 
//     /**
//      * Return the maximum number of sequence numbers that can be encoded for a
//      * given time by this implementation.
//      */
//     public int maxSequenceNumbers();
// }
// 
// Path: fauxflake-core/src/main/java/com/github/rholder/fauxflake/util/StringUtils.java
// public static String leftPad(String str, int size) {
//     return leftPad(str, size, ' ');
// }


// Path: fauxflake-core/src/main/java/com/github/rholder/fauxflake/provider/boundary/FlakeEncodingProvider.java
import com.github.rholder.fauxflake.api.EncodingProvider;
import java.nio.ByteBuffer;
import static com.github.rholder.fauxflake.util.StringUtils.leftPad;
import static java.lang.Long.toHexString;

        buffer[15] = (byte) (rest);

        return buffer;
    }

    /**
     * This always throws an {@link UnsupportedOperationException} since the
     * output of this {@link EncodingProvider} doesn't fit in 4 bytes.
     *
     * @param time     a time value to encode
     * @param sequence a sequence value to encode
     * @return never returns
     */
    @Override
    public long encodeAsLong(long time, int sequence) {
        throw new UnsupportedOperationException("Long value not supported");
    }

    /**
     * Return the 32 character left padded hex version of the given id. These
     * can be lexicographically sorted.
     *
     * @param time     a time value to encode
     * @param sequence a sequence value to encode
     * @return 32 character left padded hex version of the given id
     */
    @Override
    public String encodeAsString(long time, int sequence) {
        StringBuilder s = new StringBuilder(32);
        ByteBuffer bb = ByteBuffer.wrap(encodeAsBytes(time, sequence));
        s.append(leftPad(toHexString(bb.getLong()), 16, '0'));