/** * Gets the next available size of the requested size. If the size is available in the icon set, it will be * returned. Otherwise, the next size that is bigger than the requested size will be returned. For example, if there * are 16, 24, 32, 48, 64 size available. If the requested size is 12, 16 will be returned. If 24 is requested, 24 * will be returned. If 60 is requested, 64 will be returned. If 128 is requested and it is not available, so 64 * will be returned. * * @param size the requested size * @return the next available size. */ public int getNextAvailableSize(int size) { int[] sizes = getAvailableSizes(); int nextSize = sizes[sizes.length - 1]; for (int i : sizes) { if (i == size) { return i; } if (i > size && i < nextSize) { nextSize = i; } } return nextSize; }