Java tutorial
//package com.java2s; /** * Copyright (C) 2009-2013 Barchart, Inc. <http://www.barchart.com/> * * All rights reserved. Licensed under the OSI BSD License. * * http://www.opensource.org/licenses/bsd-license.php */ import java.nio.ByteBuffer; public class Main { public static final void checkBuffer(final ByteBuffer buffer) { if (buffer == null) { throw new IllegalArgumentException("buffer == null"); } if (!buffer.isDirect()) { throw new IllegalArgumentException("must use DirectByteBuffer"); } } }