int[] (String version, int limit) { if (version == null) { return new int[0]; } else { String[] strings = org.apache.commons.lang3.StringUtils.split(version, "._- "); int[] ints = new int[Math.min(limit, strings.length)]; int j = 0; for (int i = 0; i < strings.length && j < limit; ++i) { String s = strings[i]; if (!s.isEmpty()) { try { ints[j] = Integer.parseInt(s); ++j; } catch (Exception ignored) { } } } if (ints.length > j) { int[] newInts = new int[j]; System.arraycopy(ints, 0, newInts, 0, j); ints = newInts; } return ints; } }