code: public static IntBuffer toBuffer(int... arr) {
          ByteBuffer directBuffer = ByteBuffer.allocateDirect(arr.length * 4).order(ByteOrder.nativeOrder());
          IntBuffer buffer = directBuffer.asIntBuffer();
          for (int i = 0; i < arr.length; i++)
              buffer.put(i, arr[i]);
  
          return buffer;
      }
docs: Convert an array to a byte buffer
  @param arr the array
  @return a direct byte buffer with the array contents