Share
Explore BrainMass

Java: writing and reading numbers in/from binary file

Write a program to generate 20 random numbers between 1 and 50, write them to a binary file and then read the numbers back from the file to display them on the screen along with the frequency of occurrence of each number in a nice format. Use the Random class in the java.util package for random number generation.

Please go through the scan of requirement, and the program in attachments.

What I need is the help with part of "along with the frequency of occurrence of each number in a nice format" that means if there is repeated number it should indicate it by showing the frequency of it.

Attachments

Solution Preview

Please find the modified file Program6.java attached as 281680.java, that meets the frequency requirement.

An example run with the modified file.

Random numbers ...

$2.19