I need help. I dont know what to do next to get the following output:

groceries.csv:  (file needed to input at command prompt (args))
Name, Number
natto, 3
eggs, 12
shiitake, 1
negi, 1
garlic, 5
umeboshi, 1



(need to output as shown below):
number of integers in file "groceries.csv" = 6
index = 0, element = 3
index = 1, element = 12
index = 2, element = 1
index = 3, element = 1
index = 4, element = 5
index = 5, element = 1
also:
Here is example output for input file electricity.txt: (attached .txt file)


number of integers in file "electricity.txt" = 4
index = 0, element = 1877
index = 1, element = 1923
index = 2, element = 1879
index = 3, element = 2000



import java.util.Scanner;
import java.io.File;
import java.util.StringTokenizer;
import java.util.InputMismatchException;
import java.io.FileNotFoundException;


public class KashiwabaraNicole3
{
/*******************************************************************************
*  Outputs integers from user input external files.
********************************************************************************/


public static void main(String[] commandlineArguments) {



//Error Checking For Command Line Arguments..
if(commandlineArguments.length == 0){
System.out.println("Please enter the file name " +
"as the 1st commandline argument.");
}
else{
//connect to file (does NOT create new file)
for(int i=0; i<commandlineArguments.length; i++)
{System.out.println();
File file = new File(commandlineArguments);


Scanner inputFromFile = null;


try {
inputFromFile = new Scanner(file);
}
catch (FileNotFoundException exception) {
//Print error message.
//In order to print double quotes("),
//the escape sequence for double quotes (\") must be used.
System.out.print("ERROR: File not found for \"");
System.out.println(commandlineArguments[0]+"\"");
}
//if made connection to file, read from file
//keeps looping if file has more lines..
while (inputFromFile.hasNextLine()) {
//get a line of text..
String line = inputFromFile.nextLine();


}
String [] elementList = KashiwabaraNicole3test.createOutput(file);
KashiwabaraNicole3test.displayArray(elementList);



}//end of "if" for connecting to file
}//end of "else" for commandlineArguments
}//end of main() method


public static String [] createOutput (File myFile)
{
//need to declare "array"
Scanner scan = new Scanner(myFile);
try
{
Integer numOne = scan.nextInt();
for (int i=numOne;i<arraySize;i++)
{
array = array ;
}
}
catch(InputMismatchException exception)
{
}
return arraySize;



}
public static void displayArray(String [] anArray)
{
int num = 0;
Integer lengthOfArray = anArray.length;
System.out.println("number of intergers in file " + commandlineArguments + " = " + lengthOfArray);



for (int i = 0; i < lengthOfArray; index++)// Initialize the array values
{


Integer lengthOfArray = anArray.length();
System.out.println("index = " + num +  " , element = " + anArray);
num++;
}


}
}

Your code is a mess. What are you trying to accomplish?
Also you posted code with no code tags, without specifying your problem and where you get it.
Simply by saying it doesn't work won't get you any help

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.