private static String asHexString(int denseSize,
                                      TensorType.Value cellType,
                                      Function<Integer, Double> dblSrc,
                                      Function<Integer, Float> fltSrc)
    {
        StringBuilder buf = new StringBuilder();
        switch (cellType) {
            case DOUBLE:
                for (int i = 0; i < denseSize; i++) {
                    double d = dblSrc.apply(i);
                    long bits = Double.doubleToRawLongBits(d);
                    for (int nibble = 16; nibble-- > 0; ) {
                        int digit = (int) (bits >> (4 * nibble)) & 0xF;
                        buf.append(hexDigits[digit]);
                    }
                }
                break;
            case FLOAT:
                for (int i = 0; i < denseSize; i++) {
                    float f = fltSrc.apply(i);
                    int bits = Float.floatToRawIntBits(f);
                    for (int nibble = 8; nibble-- > 0; ) {
                        int digit = (bits >> (4 * nibble)) & 0xF;
                        buf.append(hexDigits[digit]);
                    }
                }
                break;
            case BFLOAT16:
                for (int i = 0; i < denseSize; i++) {
                    float f = fltSrc.apply(i);
                    int bits = Float.floatToRawIntBits(f);
                    for (int nibble = 8; nibble-- > 4; ) {
                        int digit = (bits >> (4 * nibble)) & 0xF;
                        buf.append(hexDigits[digit]);
                    }
                }
                break;
            case INT8:
                for (int i = 0; i < denseSize; i++) {
                    byte bits = fltSrc.apply(i).byteValue();
                    for (int nibble = 2; nibble-- > 0; ) {
                        int digit = (bits >> (4 * nibble)) & 0xF;
                        buf.append(hexDigits[digit]);
                    }
                }
                break;
        }
        return buf.toString();
    }
Serializes the given tensor type and value into a short-form JSON format.

@deprecated use #encode(#Tensor, boolean, boolean)
vespajlib/src/main/java/com/yahoo/tensor/serialization/JsonFormat.java