// Path: src/main/java/com/yahoo/memory4/UnsafeUtil.java
// public static final int ARRAY_BOOLEAN_BASE_OFFSET;
// 
// Path: src/main/java/com/yahoo/memory4/UnsafeUtil.java
// public static final int ARRAY_BYTE_BASE_OFFSET;
// 
// Path: src/main/java/com/yahoo/memory4/UnsafeUtil.java
// public static final int ARRAY_CHAR_BASE_OFFSET;
// 
// Path: src/main/java/com/yahoo/memory4/UnsafeUtil.java
// public static final int ARRAY_DOUBLE_BASE_OFFSET;
// 
// Path: src/main/java/com/yahoo/memory4/UnsafeUtil.java
// public static final int ARRAY_FLOAT_BASE_OFFSET;
// 
// Path: src/main/java/com/yahoo/memory4/UnsafeUtil.java
// public static final int ARRAY_INT_BASE_OFFSET;
// 
// Path: src/main/java/com/yahoo/memory4/UnsafeUtil.java
// public static final int ARRAY_LONG_BASE_OFFSET;
// 
// Path: src/main/java/com/yahoo/memory4/UnsafeUtil.java
// public static final int ARRAY_SHORT_BASE_OFFSET;
// 
// Path: src/main/java/com/yahoo/memory4/UnsafeUtil.java
// public static final int BOOLEAN_SHIFT   = 0;
// 
// Path: src/main/java/com/yahoo/memory4/UnsafeUtil.java
// public static final int BYTE_SHIFT      = 0;
// 
// Path: src/main/java/com/yahoo/memory4/UnsafeUtil.java
// public static final int CHAR_SHIFT      = 1;
// 
// Path: src/main/java/com/yahoo/memory4/UnsafeUtil.java
// public static final int DOUBLE_SHIFT    = 3;
// 
// Path: src/main/java/com/yahoo/memory4/UnsafeUtil.java
// public static final int FLOAT_SHIFT     = 2;
// 
// Path: src/main/java/com/yahoo/memory4/UnsafeUtil.java
// public static final int INT_SHIFT       = 2;
// 
// Path: src/main/java/com/yahoo/memory4/UnsafeUtil.java
// public static final int LONG_SHIFT      = 3;
// 
// Path: src/main/java/com/yahoo/memory4/UnsafeUtil.java
// public static final int SHORT_SHIFT     = 1;


import static com.yahoo.memory4.UnsafeUtil.ARRAY_BOOLEAN_BASE_OFFSET;
import static com.yahoo.memory4.UnsafeUtil.ARRAY_BYTE_BASE_OFFSET;
import static com.yahoo.memory4.UnsafeUtil.ARRAY_CHAR_BASE_OFFSET;
import static com.yahoo.memory4.UnsafeUtil.ARRAY_DOUBLE_BASE_OFFSET;
import static com.yahoo.memory4.UnsafeUtil.ARRAY_FLOAT_BASE_OFFSET;
import static com.yahoo.memory4.UnsafeUtil.ARRAY_INT_BASE_OFFSET;
import static com.yahoo.memory4.UnsafeUtil.ARRAY_LONG_BASE_OFFSET;
import static com.yahoo.memory4.UnsafeUtil.ARRAY_SHORT_BASE_OFFSET;
import static com.yahoo.memory4.UnsafeUtil.BOOLEAN_SHIFT;
import static com.yahoo.memory4.UnsafeUtil.BYTE_SHIFT;
import static com.yahoo.memory4.UnsafeUtil.CHAR_SHIFT;
import static com.yahoo.memory4.UnsafeUtil.DOUBLE_SHIFT;
import static com.yahoo.memory4.UnsafeUtil.FLOAT_SHIFT;
import static com.yahoo.memory4.UnsafeUtil.INT_SHIFT;
import static com.yahoo.memory4.UnsafeUtil.LONG_SHIFT;
import static com.yahoo.memory4.UnsafeUtil.SHORT_SHIFT;
import java.io.File;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
   */
  public abstract WritableMemory writableRegion(long offsetBytes, long capacityBytes);

  /**
   * Returns a read-only version of this memory
   * @return a read-only version of this memory
   */
  public abstract Memory asReadOnly();

  //ALLOCATE HEAP VIA AUTOMATIC BYTE ARRAY
  /**
   * Creates on-heap WritableMemory with the given capacity
   * @param capacityBytes the given capacity in bytes
   * @return WritableMemory for write operations
   */
  public static WritableMemory allocate(final int capacityBytes) {
    final MemoryState state = new MemoryState();
    state.putUnsafeObject(new byte[capacityBytes]);
    state.putUnsafeObjectHeader(ARRAY_BYTE_BASE_OFFSET);
    state.putCapacity(capacityBytes);
    return new WritableMemoryImpl(state);
  }

  //ACCESS PRIMITIVE HEAP ARRAYS for write

  /**
   * Wraps the given primitive array for write operations
   * @param arr the given primitive array
   * @return WritableMemory for write operations
   */
// Path: src/main/java/com/yahoo/memory4/UnsafeUtil.java
// public static final int ARRAY_BOOLEAN_BASE_OFFSET;
// 
// Path: src/main/java/com/yahoo/memory4/UnsafeUtil.java
// public static final int ARRAY_BYTE_BASE_OFFSET;
// 
// Path: src/main/java/com/yahoo/memory4/UnsafeUtil.java
// public static final int ARRAY_CHAR_BASE_OFFSET;
// 
// Path: src/main/java/com/yahoo/memory4/UnsafeUtil.java
// public static final int ARRAY_DOUBLE_BASE_OFFSET;
// 
// Path: src/main/java/com/yahoo/memory4/UnsafeUtil.java
// public static final int ARRAY_FLOAT_BASE_OFFSET;
// 
// Path: src/main/java/com/yahoo/memory4/UnsafeUtil.java
// public static final int ARRAY_INT_BASE_OFFSET;
// 
// Path: src/main/java/com/yahoo/memory4/UnsafeUtil.java
// public static final int ARRAY_LONG_BASE_OFFSET;
// 
// Path: src/main/java/com/yahoo/memory4/UnsafeUtil.java
// public static final int ARRAY_SHORT_BASE_OFFSET;
// 
// Path: src/main/java/com/yahoo/memory4/UnsafeUtil.java
// public static final int BOOLEAN_SHIFT   = 0;
// 
// Path: src/main/java/com/yahoo/memory4/UnsafeUtil.java
// public static final int BYTE_SHIFT      = 0;
// 
// Path: src/main/java/com/yahoo/memory4/UnsafeUtil.java
// public static final int CHAR_SHIFT      = 1;
// 
// Path: src/main/java/com/yahoo/memory4/UnsafeUtil.java
// public static final int DOUBLE_SHIFT    = 3;
// 
// Path: src/main/java/com/yahoo/memory4/UnsafeUtil.java
// public static final int FLOAT_SHIFT     = 2;
// 
// Path: src/main/java/com/yahoo/memory4/UnsafeUtil.java
// public static final int INT_SHIFT       = 2;
// 
// Path: src/main/java/com/yahoo/memory4/UnsafeUtil.java
// public static final int LONG_SHIFT      = 3;
// 
// Path: src/main/java/com/yahoo/memory4/UnsafeUtil.java
// public static final int SHORT_SHIFT     = 1;


// Path: src/main/java/com/yahoo/memory4/WritableMemory.java
import static com.yahoo.memory4.UnsafeUtil.ARRAY_BOOLEAN_BASE_OFFSET;
import static com.yahoo.memory4.UnsafeUtil.ARRAY_BYTE_BASE_OFFSET;
import static com.yahoo.memory4.UnsafeUtil.ARRAY_CHAR_BASE_OFFSET;
import static com.yahoo.memory4.UnsafeUtil.ARRAY_DOUBLE_BASE_OFFSET;
import static com.yahoo.memory4.UnsafeUtil.ARRAY_FLOAT_BASE_OFFSET;
import static com.yahoo.memory4.UnsafeUtil.ARRAY_INT_BASE_OFFSET;
import static com.yahoo.memory4.UnsafeUtil.ARRAY_LONG_BASE_OFFSET;
import static com.yahoo.memory4.UnsafeUtil.ARRAY_SHORT_BASE_OFFSET;
import static com.yahoo.memory4.UnsafeUtil.BOOLEAN_SHIFT;
import static com.yahoo.memory4.UnsafeUtil.BYTE_SHIFT;
import static com.yahoo.memory4.UnsafeUtil.CHAR_SHIFT;
import static com.yahoo.memory4.UnsafeUtil.DOUBLE_SHIFT;
import static com.yahoo.memory4.UnsafeUtil.FLOAT_SHIFT;
import static com.yahoo.memory4.UnsafeUtil.INT_SHIFT;
import static com.yahoo.memory4.UnsafeUtil.LONG_SHIFT;
import static com.yahoo.memory4.UnsafeUtil.SHORT_SHIFT;
import java.io.File;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;

   */
  public abstract WritableMemory writableRegion(long offsetBytes, long capacityBytes);

  /**
   * Returns a read-only version of this memory
   * @return a read-only version of this memory
   */
  public abstract Memory asReadOnly();

  //ALLOCATE HEAP VIA AUTOMATIC BYTE ARRAY
  /**
   * Creates on-heap WritableMemory with the given capacity
   * @param capacityBytes the given capacity in bytes
   * @return WritableMemory for write operations
   */
  public static WritableMemory allocate(final int capacityBytes) {
    final MemoryState state = new MemoryState();
    state.putUnsafeObject(new byte[capacityBytes]);
    state.putUnsafeObjectHeader(ARRAY_BYTE_BASE_OFFSET);
    state.putCapacity(capacityBytes);
    return new WritableMemoryImpl(state);
  }

  //ACCESS PRIMITIVE HEAP ARRAYS for write

  /**
   * Wraps the given primitive array for write operations
   * @param arr the given primitive array
   * @return WritableMemory for write operations
   */
  public static WritableMemory wrap(final boolean[] arr) {