code: public DataBuffer asNd4jBuffer(DataType type, int elementSize) {
          int length = content.length / elementSize;
          DataBuffer ret = Nd4j.createBuffer(ByteBuffer.allocateDirect(content.length),type,length,0);
          for(int i = 0; i < length; i++) {
              switch(type) {
                  case DOUBLE:
                      ret.put(i,getDouble(i));
                      break;
                  case INT:
                      ret.put(i,getInt(i));
                      break;
                  case FLOAT:
                      ret.put(i,getFloat(i));
                     break;
                  case LONG:
                      ret.put(i,getLong(i));
                      break;
              }
          }
          return ret;
      }
docs: Convert the underlying contents of this {@link Writable}
  to an nd4j {@link DataBuffer}. Note that this is a *copy*
  of the underlying buffer.
  Also note that {@link java.nio.ByteBuffer#allocateDirect(int)}
  is used for allocation.
  This should be considered an expensive operation.
  
  This buffer should be cached when used. Once used, this can be
  used in standard Nd4j operations.
  
  Beyond that, the reason we have to use allocateDirect
  is due to nd4j data buffers being stored off heap (whether on cpu or gpu)
  @param type the type of the data buffer
  @param elementSize the size of each element in the buffer
  @return the equivalent nd4j data buffer