public boolean hasOffsets(Method method) {
   Class<?> last = null;
   for (int i = 0; i < method.getParameterTypes().length; i++) {
     Class<?> param = method.getParameterTypes()[i];
     if (last != null && last.isArray() && param.equals(Integer.TYPE)) return true;
     last = param;
   }
   return false;
 }
  protected Class<?> nioBufferClass(Class<?> clazz) {
    Class<?> compType = clazz.getComponentType();

    if (compType == null) {
      return null;
    } else if (compType.equals(Character.TYPE)) {
      return CharBuffer.class;
    } else if (compType.equals(Integer.TYPE)) {
      return IntBuffer.class;
    } else if (compType.equals(Double.TYPE)) {
      return DoubleBuffer.class;
    } else if (compType.equals(Float.TYPE)) {
      return FloatBuffer.class;
    } else if (compType.equals(Long.TYPE)) {
      return LongBuffer.class;
    } else if (compType.equals(Short.TYPE)) {
      return ShortBuffer.class;
      // there's no boolean[]-from-ByteBuffer thing, so we're stuck with
      // boolean[]
      // } else if (compType.equals(Boolean.TYPE)) {
      //    return ByteBuffer.class;
    } else {
      return null;
    }
  }