code: public static DataBuffer readShapeFromDisk(File readFrom) throws IOException {
          try (FileInputStream os = new FileInputStream(readFrom)) {
              FileChannel channel = os.getChannel();
              // we read shapeinfo up to max_rank value, which is 32
              int len = (int) Math.min((32 * 2 + 3) * 8, readFrom.length());
              ByteBuffer buffer = ByteBuffer.allocateDirect(len);
              channel.read(buffer);
  
              ByteBuffer byteBuffer = buffer == null ? ByteBuffer.allocateDirect(buffer.array().length)
                      .put(buffer.array()).order(ByteOrder.nativeOrder()) : buffer.order(ByteOrder.nativeOrder());
  
              buffer.position(0);
              int rank = byteBuffer.getInt();
  
              val result = new long[Shape.shapeInfoLength(rank)];
  
              // filling DataBuffer with shape info
              result[0] = rank;
  
              // skipping two next values (dtype and rank again)
              // please , that this time rank has dtype of LONG, so takes 8 bytes.
              byteBuffer.position(16);
  
              // filling shape information
              for (int e = 1; e < Shape.shapeInfoLength(rank); e++) {
                  result[e] = byteBuffer.getLong();
              }
  
              // creating nd4j databuffer now
              DataBuffer dataBuffer = Nd4j.getDataBufferFactory().createLong(result);
              return dataBuffer;
          }
      }
docs: This method returns shape databuffer from saved earlier file
  
  @param readFrom
  @return
  @throws IOException