From ggc
|
01 packagepackage is used to name the directory or folder a class is in intermediate;
02
03
04 /**
05 * All about my application.
06 * @authorthis is the Javadoc tag for documenting who created the source code Jam Jenkins
07 */
08 publicpublic is used to indicate unrestricted access (any other class can have access) classclass is a group of fields and methods used for making objects ProfilingNoop
09 {open braces start code blocks and must be matched with a close brace
10 publicpublic is used to indicate unrestricted access (any other class can have access) staticstatic means that an instance is not required for access (class level access) voidvoid means the method does not return a value mainThe main method is the place where applications begin executing.(String[brackets are typically used to declare, initialize and index (indicate which element of) arrays]brackets are typically used to declare, initialize and index (indicate which element of) arrays args)
11 {open braces start code blocks and must be matched with a close brace
12 intint is the type for whole numbers and it is short for integer noops=this assignment operator makes the left side equal to the right side0;
13 longlong is the type for whole numbers (they have a larger range than int) start=this assignment operator makes the left side equal to the right sideSystem.currentTimeMillis();
14 intint is the type for whole numbers and it is short for integer size=this assignment operator makes the left side equal to the right side1600;
15 intint is the type for whole numbers and it is short for integer dummy=this assignment operator makes the left side equal to the right side0;
16 whilewhile is a looping structure for executing code repeatedly(System.currentTimeMillis()<start+adds two numbers together or concatenates Strings together1000)
17 {open braces start code blocks and must be matched with a close brace
18 forfor is a looping structure for repeatedly executing a block of code(intint is the type for whole numbers and it is short for integer j=this assignment operator makes the left side equal to the right side0; j<size; j++this is the increment operator, which increases the variable by 1)
19 forfor is a looping structure for repeatedly executing a block of code(intint is the type for whole numbers and it is short for integer i=this assignment operator makes the left side equal to the right side0; i<size; i++this is the increment operator, which increases the variable by 1)
20 //for(int i=size; i>0; i/=2)
21 dummy++this is the increment operator, which increases the variable by 1;//noop
22 noops++this is the increment operator, which increases the variable by 1;
23 }close braces end code blocks and must match an earlier open brace
24 System.out.println("I can do "+adds two numbers together or concatenates Strings togethernoops+adds two numbers together or concatenates Strings together" in 1 second.");
25 doubledouble is the type for numbers that can contain decimal fractions timePerNoop=this assignment operator makes the left side equal to the right side1.0/noops;
26 System.out.println("Each noop takes "+adds two numbers together or concatenates Strings togethertimePerNoop+adds two numbers together or concatenates Strings together" seconds.");
27 }close braces end code blocks and must match an earlier open brace
28 }close braces end code blocks and must match an earlier open brace
|
Download/View intermediate/ProfilingNoop.java