code: static byte[] incrementBlocks(byte[] counter, long blockDelta) {
          if (blockDelta == 0)
              return counter;
          if (counter == null || counter.length != 16)
              throw new IllegalArgumentException();
          // Can optimize this later.  KISS for now.
          if (blockDelta > MAX_GCM_BLOCKS)
              throw new IllegalStateException();
          // Allocate 8 bytes for a long
          ByteBuffer bb = ByteBuffer.allocate(8);
          // Copy the right-most 32 bits from the counter
          for (int i=12; i <= 15; i++)
              bb.put(i-8, counter[i]);
          long val = bb.getLong() + blockDelta;    // increment by delta
          if (val > MAX_GCM_BLOCKS)
              throw new IllegalStateException(); // overflow 2^32-2
          bb.rewind();
          // Get the incremented value (result) as an 8-byte array
          byte[] result = bb.putLong(val).array();
          // Copy the rightmost 32 bits from the resultant array to the input counter;
          for (int i=12; i <= 15; i++)
              counter[i] = result[i-8];
          return counter;
      }
docs: Increment the rightmost 32 bits of a 16-byte counter by the specified
  delta. Both the specified delta and the resultant value must stay within
  the capacity of 32 bits.
  (Package private for testing purposes.)
  
  @param counter
  a 16-byte counter used in AES/CTR
  @param blockDelta
  the number of blocks (16-byte) to increment