if (audioStream.getFormat().getSampleSizeInBits() == 16 && ByteOrder.nativeOrder() == ByteOrder.BIG_ENDIAN) { ShortBuffer tmp = data.duplicate().order(ByteOrder.LITTLE_ENDIAN).asShortBuffer(); while(tmp.hasRemaining()) data.putShort(tmp.get()); data.rewind(); }
	private IBuffer loadWAV(URL file) {		AudioInputStream audioStream = null;		try {			audioStream = AudioSystem.getAudioInputStream(file.openStream());		} catch (FileNotFoundException e) {			e.printStackTrace();		} catch (UnsupportedAudioFileException e) {			e.printStackTrace();		} catch (IOException e) {			e.printStackTrace();		}		int length = audioStream.getFormat().getChannels()				* (int) audioStream.getFrameLength()				* audioStream.getFormat().getSampleSizeInBits() / 8;		byte[] temp = new byte[length];		try {			audioStream.read(temp, 0, length);		} catch (IOException e1) {			e1.printStackTrace();		}		ByteBuffer data = BufferUtils.createByteBuffer(length);//ByteBuffer.allocateDirect(length);		data.put(temp);		data.rewind();		int channels = getChannels(audioStream.getFormat());		IBuffer[] tmp = generateBuffers(1);		tmp[0].configure(data, channels, (int) audioStream.getFormat()				.getSampleRate(), getPlayTime(temp, audioStream.getFormat(), (int)audioStream.getFormat().getSampleRate()));        LoggingSystem.getLogger().log(Level.INFO,                "Wav estimated time "+ getPlayTime(temp, audioStream.getFormat(), (int)audioStream.getFormat().getSampleRate()));		//cleanup		data.clear();		data = null;		try {			audioStream.close();		} catch (IOException e2) {			e2.printStackTrace();		}		return tmp[0];	}