private void readImages(String folderpath) { String test = ""; int offset = 0; // get words from db String sql = "SELECT word, id FROM word LIMIT " + NUM_CLASSES + " OFFSET " + offset; wordClasses = new String[NUM_CLASSES]; int classes[] = new int[NUM_CLASSES]; int index = 0; try { ResultSet rs = db.select(sql); while (rs.next()) { wordClasses[index] = rs.getString("word"); classes[index] = rs.getInt("id"); index++; } } catch (ClassNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } int number = 0; String data2 = ""; for (int j = 0; j < wordClasses.length; j++) { System.out.println(j); int files = new File(folderpath + "\\" + wordClasses[j]).listFiles().length; for (int k = 1; k <= files; k++) { File file = new File(folderpath + "\\" + wordClasses[j] + "\\" + "word (" + k + ").jpg"); Shorthand word = new Shorthand(file, wordClasses[j], classes[j]); testingSamples.add(word); } } }