diff --git a/source/net/sourceforge/filebot/ui/panel/list/ListPanel.java b/source/net/sourceforge/filebot/ui/panel/list/ListPanel.java index f953112f..23b347c8 100644 --- a/source/net/sourceforge/filebot/ui/panel/list/ListPanel.java +++ b/source/net/sourceforge/filebot/ui/panel/list/ListPanel.java @@ -2,7 +2,6 @@ package net.sourceforge.filebot.ui.panel.list; -import static java.lang.Math.log; import static java.lang.Math.max; import static java.lang.Math.min; import static java.lang.Math.signum; @@ -113,7 +112,7 @@ public class ListPanel extends FileBotPanel { // pad episode numbers with zeros (e.g. %02d) so all episode numbers have the same number of digits NumberFormat numberFormat = NumberFormat.getIntegerInstance(); - numberFormat.setMinimumIntegerDigits(max(2, (int) (log(max(from, to)) / log(10)))); + numberFormat.setMinimumIntegerDigits(max(2, Integer.toString(max(from, to)).length())); numberFormat.setGroupingUsed(false); List names = new ArrayList(); diff --git a/source/net/sourceforge/filebot/web/Episode.java b/source/net/sourceforge/filebot/web/Episode.java index 692a6073..88d451c7 100644 --- a/source/net/sourceforge/filebot/web/Episode.java +++ b/source/net/sourceforge/filebot/web/Episode.java @@ -87,10 +87,10 @@ public class Episode implements Serializable { // find max. episode number length for (Episode episode : episodes) { try { - int n = Integer.parseInt(episode.getEpisodeNumber()); + String episodeNumber = episode.getEpisodeNumber(); - if (n > 0) { - minDigits = Math.max(minDigits, (int) (Math.log(n) / Math.log(10))); + if (episodeNumber.length() > minDigits && Integer.parseInt(episodeNumber) > 0) { + minDigits = episodeNumber.length(); } } catch (NumberFormatException e) { // ignore