The purpose of this program is to take information from a file about a music collection and turn it into three arrays.
>4
>141 Pure Heroine:Lorde
>171 Lights Out:Ingrid Michaelson
>270 Unorthodox Jukebox :Bruno Mars
>190 Head Or Heart:Christina Perri
In the file, the 4 stands for how long the arrays will be, the numbers are one array, the album titles another, and the artist names are the final array. The arrays for the titles and artist names are separated by the colon. While I can create the array for the numbers, what is giving me trouble is how to create the separate arrays for name and titles. I understand that I have to convert it into a sting and use the colon as a delimiter but I'm unsure as to how.
import java.util.*;
import java.io.*;
public class tunes {
public static void main(String[] args) throws FileNotFoundException {
    int size; //Determines the size of the arrays
    Scanner input = new Scanner(new File("music.txt"));
    size = input.nextInt();
    int[] time = new int[size];
    for (int i = 0; i < time.length; i++) { // Creates an array for the numbers
        time[i] = input.nextInt();
        input.nextLine();
    }
    String[] artist = new String[size]; 
    for (int i = 0; i <artist.length; i++) { 
        while (input.hasNextLine()){
        }
     } 
    System.out.println();
    System.out.println("TOTAL TIME\t\t\t\t" + calcTotalTime(time));
    System.out.println();
    System.out.println();
    System.out.println("LONGEST TRACK");
    System.out.println("-------------");
    System.out.println();
    System.out.println();
    System.out.println("SHORTEST TRACK");
    System.out.println("--------------");
}
public static void printTable(int[] time, String[] artist, String[] title) {
    System.out.println("TITLE\t\t\t" + "ARTIST\t\t\t    " + "TIME");
    System.out.println("-----\t\t\t" + "------\t\t\t    " + "----");
    for (int i = 0; i < time.length; i++) {
        System.out.println(title[i] + "\t" + artist[i] + "\t" + time[i]);
    }
}
public static int calcTotalTime(int[] time) {
    int sum = 0;
    for (int i = 0; i < time.length; i++) {
        sum = sum + time[i];
    }
    return sum;
}
public static int findLongest(int[] time) {
    int longest = 0;
    for (int i = 1; i < time.length; i++) {
        if (time[i] > time[longest]) {
            longest = i;
        }
    }
    return longest;
}
public static int findShortest(int[] time) {
    int shortest = 0;
    for (int i = 1; i < time.length; i++) {
        if (time[i] < time[shortest]) {
            shortest = i;
        }
    }
    return shortest;
}
}
An example of how the output would look like would be
>Pure Heroine       Lorde              141
>Lights Out         Ingrid Michaelson  171
>Unorthodox Jukebox Bruno Mars         270
>Head or Heart      Christina Perri    190
 
     
     
     
    