So step 1, 2, 3(for worst case) and 7 will occur once
No, that's completely wrong - see below
System.currentTimeMillis() returns the current time in milliseconds.
But time complexity is more theoretical than that. Just timing algorithms won't tell you that unless you run many very very large test cases.
You have to examine the code and how it scales up with large data values to determine the time complexity.
Eg, with your example the outer loop will be executed n times. The inner loop will be executed on average n/2 times for each time the outer loop executes. So the code in the inner loop will be executed n*n/2 times - that's O(n^2).