public final class BoundaryModel {
    public static void main(String[] args) {
        long capacity = 50;
        long offset = 48;
        long storeSize = 64;
        boolean fits = offset >= 0 && offset <= capacity
                && storeSize >= 0 && storeSize <= capacity - offset;

        System.out.println("Fits inside array: " + fits); // false
        System.out.println("Bytes remaining: " + (capacity - offset)); // 2
        System.out.println("Bytes beyond boundary: "
                + (storeSize - (capacity - offset))); // 62
    }
}
