Java Essay

Write a Java program to demonstrate using bitmaps and bitwise operators to sort and remove duplicates from folders of unique phone numbers. Do not confuse the word bitmap intended for compressing info into smaller sized spaces with all the bitmap which has come to mean a graphic image. You will use this file of some million randomly phone numbers with possible repeats in args[0]. In addition , will be given a great output filename provided inargs[1] into which you will write the sorted list of telephone numbers without duplicates. Each phone number begins with the digit a couple of or higher so phone numbers are 2000000 through 9999999. There are no area rules or country code prefixes to deal with. The file appears something like: 9827019

5655875

2593305

8586163

6115967

9128969

9998369

8551496

...

Here are several declarations to get started on:

Scanner inFile = new Scanner(new FileReader(args[0]));

PrintWriter outFile = fresh PrintWriter(args[1]);

byte[] bitmap sama dengan new byte[1000000];

You will use a bitmap as a multitude of 1, 1000, 000 bytes (that is, the type byte). Each bit in the array of a million bytes will represent 1 phone number. The small amount will be switched on if and only if the amount was read from the document. Those portions that continue to be off is going to indicate the number was under no circumstances found in the file. You will need to review Bitwise Employees.

Using this bitmap association will guarantee no repeats in the resulting file and since a side effect automatically sorts the data because you will method the bitmap sequentially via beginning to end inspecting just and producing the phone quantity represented by that bit to the result file in case the bit is usually turned on. Procedure all values before publishing to the result file.

The output record should have each of the found figures with no duplicates in climbing, sorted order. As a guide d2. dat is supplied above and it is 32, 000, 000 octet. Your result file ought to be 25, 195, 720 octet on Unix or 28, 345, 185 in Windows/DOS. Values other than this reveal an error in processing and also you...



Case Study about Oticon aS Essay

Related

Category

News