code: public static ByteBuffer getImageData(int[] pixels, Format format, int width, int height) {
          final ByteBuffer data = CausticUtil.createByteBuffer(width * height * format.getComponentCount());
          for (int y = height - 1; y >= 0; y--) {
              for (int x = 0; x < width; x++) {
                  final int pixel = pixels[x + y * width];
                  if (format.hasRed()) {
                      data.put((byte) (pixel >> 16 & 0xff));
                  }
                  if (format.hasGreen()) {
                      data.put((byte) (pixel >> 8 & 0xff));
                  }
                  if (format.hasBlue()) {
                      data.put((byte) (pixel & 0xff));
                  }
                  if (format.hasAlpha()) {
                      data.put((byte) (pixel >> 24 & 0xff));
                  }
              }
          }
          data.flip();
          return data;
      }
docs: Sets the texture's image data. The image data reading is done according to the given {@link com.flowpowered.caustic.api.gl.Texture.Format}. The returned buffer is flipped an ready for reading.
  
  @param pixels The image pixels
  @param width The width of the image
  @param height the height of the image
  @return The flipped buffer containing the decoded image data