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
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.");
//connect to file (does NOT create new file)
for(int i=0; i<commandlineArguments.length; i++)
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 \"");
//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);

}//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);
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);


Edited by happygeek: fixed formatting

by Dave Barry

TODAY'S SCIENTIFIC QUESTION IS: What in the world is electricity and
where does it go after it leaves the toaster?
Here is a simple experiment that will teach you an important electrical
lesson. On a cool day, scuff your feet along a carpet, then reach your
hand into a friend's mouth and touch one of his dental fillings. Did you
notice how your friend twitched violently and cried out in pain? This
teaches one that electricity can be a very powerful force, but we must
never use it to hurt others unless we need to learn an important lesson
about electricity.
It also illustrates how an electrical circut works. When you scuffed
your feet, you picked up batches of "electrons", which are very small
objects that carpet manufacturers weave into carpets so they will attract
dirt. The electrons travel through your bloodstream and collect in your
finger, where they form a spark that leaps to your friends filling, then
travel down to his feet and back into the carpet, thus completing the
circut. AMAZING ELECTRONIC FACT: If you scuffed your feet long enough
without touching anything, you would build up so many electrons that your
finger would explode. This is nothing to worry about unless you have
carpeting. Although we modern persons tend to take our electric lights,
radios, mixers, etc. for granted, hundreds of years ago people did not
have any of these things, which is just as well since there was no place to
plug them in. Then along came the first electrical pioneer, Benjamin
Franklin, who flew a kite in an electrical storm and received a serious
electrical shock. This proved that lightning was powered by the same force
as carpets, but it also damaged Franklin's brain so severely that he
started speaking only in incomprehensible maxims, such as "A penny saved is
a penny earned". Eventually he had to be given a job running the post
office. After Franklin came a herd of electrical pioneers whose names have
become part of our electrical terminology: Myron Volt, Mary Louise AMP,
James Watt, Bob Transformer, etc. These pioneers conducted many important
electrical experiments. Galvani discovered (this is the truth) that when
he attached two different kinds of metal to the leg of a frog, an
electrical current developed and the frog's leg kicked, even though it was
no longer attached to the frog, which was dead anyway. Galvani's discovery
led to enormous advances in amphibian medicine. Today skilled veterinary
surgeons can take a frog that has been seriously injured or killed, implant
pieces of metal in its muscles, and watch it hop back into the pond ...
almost. The greatest electrical pioneer of them all was Thomas Edison. He
was a brillian inventor despite the fact that he had little formal
education and lived in New Jersey. Edison's first major invention in 1877
was the phonograph. It could be found in thousands of american homes where
it sat until 1923 when the record was invented. Edison's greatest
achievment came in 1879 when he invented the electric company. Edison's
design was a brilliant adaptation of the simple electrical circut. The
electric company sends the electricity through a wire to the customer, then
immediately gets the electricity back through another wire. Then (this is
the brilliant part) they send it right back to the customer again. This
means that the electric company can sell a customer the same batch of
electricity thousands of times a day and never get caught, since very few
customers take the time to examine their electricity very closely. In
fact, the last year any NEW electricity was generated was 1937. Today,
thanks to men like Edison and Franklin, and frogs like Galvani's, we
receive almost unlimited benefits from electricity. In the past decade,
scientists have developed the laser, an electronic device so powerful that
it can vaporize a bulldozer at 2000 yards, yet so precise that doctors can
use it to perform delicate operations on the human eyeball, provided they
remember to change the power setting from "bulldozer" to "eyeball".
9 Years
Discussion Span
Last Post by javaAddict

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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.