64-bit CPU friends to see

Source: Internet
Author: User
I wrote an sort algorithm to test the speed, but the 100 x W has exceeded the 32-bit limit. The 32-bit PC should be the power of 2, I hope a friend with a 64-bit CPU can test it. Of course, don't forget to tell me the result.

Import java. util .*;
Class dumbsort {
Public static void main (string [] ARGs ){
Final int F1 = 100000;
Int [] A = new int [F1];
Int I = 0;
Random Rand = new random ();
For (; I <A. length; I ++)
{
A [I] = Rand. nextint (1000000 );
}
Int innerloop = 0;
Int outerloop = 0;
Int swaps = 0;

For (I = 0; I <A. length; I ++ ){
Outerloop ++;
For (Int J = 1; j <A. length; j ++ ){
Innerloop ++;
If (A [J-1]> A [J]) {
Int temp = A [J-1];
A [J-1] = A [J];
A [J] = temp;
SWAps ++;
}
}
}

For (I = 0; I <A. length; I ++)
System. Out. Print (A [I] + "/N ");

System. Out. println ();
System. Out. println ("outer loop executed" + outerloop + "Times .");
System. Out. println ("inner loop executed" + innerloop + "Times .");
System. Out. println (SWAPs + "swaps completed .");
}
}
 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.