Quantcast
Channel: BlogoSfera » numeric
Viewing all articles
Browse latest Browse all 12

Get the highest numeric file name(as int) from directory – Java

$
0
0

Given a File dir I need to find the highest numeric file name(if any exist) My approach: // get the highest numeric file name(as int) from given directory public static final int getHighestNumericFileName(File dir) { int result = -1; for (File f : dir.listFiles()) { String name = f.getName(); name = name.substring(0, name.indexOf('.')); if (StringUtils.isNumeric(name)) […]

The post Get the highest numeric file name(as int) from directory – Java appeared first on BlogoSfera.


Viewing all articles
Browse latest Browse all 12

Trending Articles