tags:

views:

33

answers:

1

hi friends, I have text files with some numbers like

   100
   38963
   27856
   0
   534

From this numbers i want to find maximum numbers and want to assign the value for max number as 1. From that i want to assign values to other numbers which is least.For example the first one want to give (38963/100)*100. I want to do all this using java program. Please anybody help me.

+1  A: 

To read lines of text from a file, you can wrap a FileReader in a BufferedReader. You can use String.split() to split a line of text into tokens around spaces, and you can use Integer.parseInt() to turn a String representing a valid integer into an int.

You can find the maximum and minimum of a list of ints in linear time (examining each int once) using two ints worth of storage.

That should be enough to get you started.

Edit: just realized those were supposed to be on separate lines (you should use the formatting tools when posting). String.split() will be unnecessary, then.

danben