[Solved]Illegal Argument Exception

I’m working on a 3d game and I’ve been having some trouble with my Texture Manager.
Here is the code I’m using (Sorry its a bit sloppy):
[spoiler]


import java.awt.image.BufferedImage;
import java.awt.image.DataBufferByte;
import java.io.IOException;

import java.nio.ByteBuffer;
import java.nio.IntBuffer;
import java.util.HashMap;

import javax.imageio.ImageIO;

import org.lwjgl.BufferUtils;
import org.lwjgl.opengl.GL11;




public class TextureMananger {
	public static final boolean DBG = true; //Debug
	public static TextureMananger img;
	public static ResourceLoader resourceLoader = new ResourceLoader();
	/* Number Of Textures Loaded */
	public static int totalImagesLoaded = 0;
	private static HashMap<String, Number> loadedImages = new HashMap<String, Number>();
	
	public static int loadTexture(String texture) throws IOException {
		if (loadedImages.get(texture) != null) {
			if (DBG) System.out.println("[Textures] Texture '" + texture.toString() + "' was already loaded! ID is " + loadedImages.get(texture.toString()).intValue() + ".");

			return loadedImages.get(texture.toString()).intValue();

		} else {
			BufferedImage image = ImageIO.read(resourceLoader.loadResource(texture));
			int width = image.getWidth();
			int height = image.getHeight();
			DataBufferByte rawData =  (DataBufferByte) image.getData().getDataBuffer();
			
			ByteBuffer data = BufferUtils.createByteBuffer(rawData.getSize());
	        data.put(rawData.getData());
	        data.rewind();
	        //data.clear();
	        IntBuffer scratch = BufferUtils.createIntBuffer(1);
	        
	        GL11.glGenTextures(scratch);
	        GL11.glBindTexture(GL11.GL_TEXTURE_2D, scratch.get(0));
	        GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR);
	        GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);
	        GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA, width, height, 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, data);
	        GL11.glBindTexture(GL11.GL_TEXTURE_2D, 0);
	        totalImagesLoaded++;
	        loadedImages.put(texture.toString(), scratch.get(0));
	        System.out.println(TextureMananger.class.getClass().getResource(texture));
			if (DBG) System.out.println("[Textures] Texture '" + texture.toString() + "' was Loaded! ID is " + loadedImages.get(texture.toString()).intValue() + ".");
	        return scratch.get(0);  
	        
		}
		
	}

		
	
		
	
	
}

[/spoiler]

And here is the error im getting:

java.lang.IllegalArgumentException: Number of remaining buffer elements is 768, must be at least 1024. Because at most 1024 elements can be returned, a buffer with at least 1024 elements is required, regardless of actual returned element count

I’m not to good with buffers and rendering stuff, so any help would be appreciated.