I want to measure time of getting elements of ArrayList. I know that using ArrayList we can get any element in constant time. I tried to check this writing code, but it returns wrong result for first element.  My code:  private long getGetTime(int position) {     long elapsedTime = 0;     long start = System.nanoTime();       list.get(position);      long end = System.nanoTime();     elapsedTime = end - start;      return elapsedTime; } preapareStructure(); System.out.println("read 0, time: " + getGetTime(0)); System.out.println("read size/2, time: " + getGetTime(list.size()/2)); System.out.println("read size-1, time: " + getGetTime(list.size()-1));   And this returns something like this:   read 0, time: 10243 read size/2, time: 843 read size-1, time: 843
How do you write (and run) a correct micro-benchmark in Java?  I'm looking for some code samples and comments illustrating various things to think about.  Example: Should the benchmark measure time/iteration or iterations/time, and why?  Related:
I want to create buffer polygon(with curved edges) from  points like this using ArcGIS for Desktop.   distance toward North from a point 5, toward South 1.5, toward west 1, toward East 2.   all this distance is attached as attribute in point in different fields. In most of the mechanics textbooks , the  is stated without any justification or an experiment to confirm this law. Also after introducing this law forces are also decomposed without any justification. Please suggest any links or books related to this. Any help will be appreciated. Thanks in advance. Why do we say that the Earth moves around the Sun? I want to split a long equation in many lines I have a long line in equation. I want to split it properly in two or three lines. I've been using \begin{split} and \end{split}, but still it is not in good position. The equation's code is below.  \begin{equation} \begin{split} \frac{r(r-1)c_{0}}{z} + \\ &amp;  \sum_{0}^{\infty}[[(j+r)(j+r+1)c_{j+1} - [(j+r)(j+r-1) - l(l+1)]c_{j}] \\ &amp;= 0, \end{split} \end{equation} Is gravity just electromagnetic attraction? Recently, I  was pondering over the thought that is most of the elementary particles have intrinsic magnetism, then can gravity be just a weaker form of electromagnetic attraction? But decided the idea was silly.    But I then googled it and found  article. Is this idea really compatible with other theories as the article mentions? Is there any chance of this proposition being true? Conditional expectation of $X$ given $\sin(X)$ Is Ubuntu an open source software? General identity for a double summation theorem I've been reading a research paper, and I'm interested in generalizing a certain theorem but I can't seem to understand how the following results are derived:  $$\sum_{i=1}^{n}\sum_{j\neq i}^n \frac{1}{z_i-z_j}=0$$  $$\sum_{i=1}^{n}\sum_{j\neq i}^n \frac{z_i}{z_i-z_j}=\frac{1}{2}n(n-1)$$ $$\sum_{i=1}^{n}\sum_{j\neq i}^n \frac{z_i^2}{z_i-z_j}=(n-1)\sum_{i=1}^n z_i$$ $$\sum_{i=1}^{n}\sum_{j\neq i}^n \frac{z_i^3}{z_i-z_j}=(n-1)\sum_{i=1}^n z_i^2 + \sum_{i&lt;j}^n z_i z_j$$ What is the C# equivalent of NaN or IsNumeric? I used MiKTeX 2.9 on windows. I have downloaded a package I want to install from the internet (manually, not through MiKTeX). The archive (*.lmza) containing the package was saved to a directory on my C:\ drive. Through MikTeX -> Maintenance -> Settings -> Packages -> Change... I can select the directory in which I have saved the archive containing the package. However, if I choose Packages shall be installed from a directory and choose the location of the package, I get this error message: C:\my\package\is\here does not seem to be a local package repository. What does it take for a directory/folder to become a local package repository? What are the highest DC and AC voltages or currents that can be considered as safe? Is it possible to interrupt spellcasting? Assumptions of linear regression In Drush 8, my site aliases are loaded correctly from ~/.drush/mysite.aliases.drushrc.php.  E.g.  $aliases['dev'] = array(   'root' =&gt; '/var/www/html/mysite.dev/docroot',   'uri' =&gt; 'mysite.prod.acquia-sites.com',   'remote-host' =&gt; 'mysite.ssh.acquia-sites.com',   'remote-user' =&gt; 'mysite.dev',   'path-aliases' =&gt; array(     '%drush-script' =&gt; 'drush' . $drush_major_version,   ), );   However these aliases aren't loaded in Drush 9.  $ drush site-alias {  }   How I should define site aliases in Drush 9? Is there any migration process? I am not a native English speaker, I usually hear “something caught my eye” but never “something caught (both) my eyes”. This seems pretty strange to me.  Cambridge Dictionaries Online provide these examples but without any explanation        (i) to get someone's ​attention:   A ​sudden ​movement ​caught my ​eye.        (ii) to get someone's ​attention, ​especially by ​looking at them:   I ​tried to catch the waiter's ​eye, so we could ​order.        (iii) to be ​attractive or different enough to be ​noticed by someone:   It was the ​unusual ​colour of his ​jacket that ​caught my ​eye.   Why is only one eye ‘caught”? Doesn't something catch our sight? We normally see with both eyes, not with one. How to calculate the variance of a partition of variables I'm running an experiment where I'm gathering (independent) samples in parallel, I compute the variance of each group of samples and now I want to combine then all to find the total variance of all the samples.   I'm having a hard time finding a derivation for this as I'm not sure of terminology. I think of it as a partition of one RV.   So I want to find $Var(X)$ from $Var(X_1)$, $Var(X_2)$, ..., and $Var(X_n)$, where $X$ = $[X_1, X_2, \dots, X_n]$.  EDIT: The partitions are not the same size/cardinality, but the sum of the partition sizes equal the number of samples in the overall sample set.  EDIT 2: There is a formula for a , but it only covers the case of a partition into two sets, not $n$ sets. Word style "keep with next" except on last item Defining my own command Is there a streaming API for JSON? My local hackerspace has a CNC machine.  I can give them my Gerbers and they can print out the PCB.  The machine does not plate VIAs.  I need to do this after the CNC machine is finished.  What is the best process and materials to use?