I'm trying to write a java program to test following code  12,8,23,6,5,17,20,9  m=2; n=0; while m&lt;array length repeat ar[m]=ar[n]+ar[n+1]; m++; n++; End while    So this was my source code   public class Main {    public static void main(String [] args) {     int []x= {12,8,23,6,5,17,0,9};     int m=2;     int n=0;       while(m&lt;x.length) {         x[m]=x[n]+x[n+1];         m++;         n++;          System.out.println(x);       }    } }   And it generated something like this as the output  [I@3d4eac69 [I@3d4eac69 [I@3d4eac69 [I@3d4eac69 [I@3d4eac69 [I@3d4eac69   Also this was my teacher's answer   public class Main {  public static void main(String [] args) {     int []x= {12,8,23,6,5,17,0,9};     int []y=algo(x); **//need an explanation**      } public static int[] algo(int[]ar) { **//need an explanation**      int m=2;     int n=0;     while(m&lt;ar.length) {         ar[m]=ar[n]+ar[n+1];         m++;         n++;     }     return ar;    } }   However there is no generated output for teacher's code.However answer should be something like this 12 8 20 28 48 76 124 200 Please explain which one is the best code and how do they works.Also I have commented some lines of my teacher's code where I can't understand . Please explain them too.
In Java, arrays don't override toString(), so if you try to print one directly, you get the className + '@' + the hex of the  of the array, as defined by Object.toString():  int[] intArray = new int[] {1, 2, 3, 4, 5}; System.out.println(intArray);     // prints something like '[I@3343c8b3'   But usually, we'd actually want something more like [1, 2, 3, 4, 5]. What's the simplest way of doing that? Here are some example inputs and outputs:  // Array of primitives: int[] intArray = new int[] {1, 2, 3, 4, 5}; //output: [1, 2, 3, 4, 5]  // Array of object references: String[] strArray = new String[] {"John", "Mary", "Bob"}; //output: [John, Mary, Bob]
Did Sidious know the secret of cheating death? Show that if $p$ is prime then $\Bbb Z_p$ is a field Check my proof please.  Let $\Bbb Z_p:=\Bbb Z/p\Bbb Z$ be the quotient ring modulo $p$. I want to prove that if $p$ is prime then $\Bbb Z_p$ is a field.  Known facts about the quotient rings of the kind $\Bbb Z_n$ (I dont list all the characteristics of a ring, just some ones):   They are commutative rings with unity. $[0]=[n]$ is the identity of addition or zero. Then $[n]+[a]=[a]$ and $[n]\cdot[a]=[n]$ for all $[a]\in\Bbb Z_n$. $[1]$ is the multiplicative identity or unity. Then $[1]\cdot[a]=[a]$ for all $[a]\in\Bbb Z_n$. The addition is defined as $[a]+[b]=[a+b]$, and the multiplication is defined as $[a]\cdot[b]=[ab]$. $[a]=[b]$ means that exists $z\in\Bbb Z$ such that $a=b+nz$. $|\Bbb Z_p|=p$.   A ring $\Bbb Z_p$ dont have zero divisors, i.e. doesnt exist $[a],[b]\in\Bbb Z_p$ distinct of $[p]$ such that $[a]\cdot[b]=[p]$. Proof by contradiction: suppose that exists such $[a],[b]$ distinct of $[p]$ that are zero divisors. Then exist some $z_j\in\Bbb Z$ such that:  $$(a+pz_1)(b+pz_2)=pz_3\iff ab+pz_4=pz_3\iff ab=pz_5$$  but this is a contradiction with the assumption that $a,b\neq p$ and $p$ prime, so dont exist divisors of zero on any $\Bbb Z_p$.$\Box$  For any $[a]\in\Bbb Z_p$ distinct of $[p]$ exist $[b]$ such that $[a][b]=[1]$. Because $\Bbb Z_p$ dont have zero divisors and is finite for some $[a]\neq[p]$ we have that if $[b]\neq[c]$ then $[a][b]\neq[a][c]$. Proof by contradiction: if $[a][b]=[a][c]$ in the above conditions then  $$[a][c]=[ac]=[ab]=[a][b]\iff ac+pz_1=ab+pz_2\iff a(c-b)=pz_3$$  for some $z_j\in\Bbb Z$. But $pz_3\in[p]$, then $[a][c-b]=[p]$ but because there are no zero divisors in $\Bbb Z_p$ then or $[a]=[p]$ or $[c-b]=[p]$ what contradicts the above conditions.$\Box$  Because $[a][b]\neq[a][c]$ for $[a]\neq[p]$ and $[b]\neq[c]$ then for any $[a]\neq[p]$ we have that  $$[a]\cdot\Bbb Z_p=\Bbb Z_p\implies \exists [b]\in\Bbb Z_p:[a][b]=[1]$$  In other words: every element of $\Bbb Z_p$ but $[p]$ have a multiplicative inverse as stated above.$\Box$  Because $\Bbb Z_p$ is a commutative ring with $[1]\neq[0]$ and have multiplicative inverse for all their elements but $[p]=[0]$ then $\Bbb Z_p$ is a field.$\Box$ Unable to set DYLD_FALLBACK_LIBRARY_PATH in shell on OSX 10.11.1 In shell scripts used for unit testing with dynamic libraries in a directory other than the typical @rpath, I have previously been able to set DYLD_FALLBACK_LIBRARY_PATH to set the directory containing the libraries. Under 10.11.1, bash seems to ignore attempts to set this environment variable:  $ sh -x testscript.sh + DYLD_FALLBACK_LIBRARY_PATH=/Users/something/testinglibs + export DYLD_FALLBACK_LIBRARY_PATH + exec printenv   and DYLD_FALLBACK_LIBRARY_PATH is not present in printenv's output.  Is this a security-related hack in 10.11's shell? I haven't been able to find this change documented in man pages or online. Regression: Transforming Variables When transforming variables, do you have to use all of the same transformation? For example, can I pick and choose differently transformed variables, as in:   Let, $x_1,x_2,x_3$ be age, length of employment, length of residence, and income.  Y = B1*sqrt(x1) + B2*-1/(x2) + B3*log(x3)   Or, must you be consistent with your transforms and use all of the same? As in:   Y = B1*log(x1) + B2*log(x2) + B3*log(x3)    My understanding is that the goal of transformation is to address the problem of normality. Looking at histograms of each variable we can see that they present very different distributions, which would lead me to believe that the transformations required are different on a variable by variable basis.   ## R Code df &lt;- read.spss(file="http://www.bertelsen.ca/R/logistic-regression.sav",                  use.value.labels=T, to.data.frame=T) hist(df[1:7])      Lastly, how valid is it to transform variables using $\log(x_n + 1)$ where $x_n$ has $0$ values? Does this transform need to be consistent across all variables or is it used adhoc even for those variables which do not include $0$'s?  ## R Code  plot(df[1:7]) Holomorphic function has at most countably zeros Let $f$ be holomorphic in a domain $U$, then $f$ has at most countably zeros.  How can I prove this statement? I have seen it in Sheng Gong  explicitly, but without any indications. Question mark and colon in JavaScript Integral of sinc function multiplied by Gaussian I am wondering whether the following integral $$\int_{-\infty}^{\infty}  \frac{\exp( - a x^2 ) \sin( bx )}{x} \,\mathrm{d}x$$ exists in closed form. I would like to use it for numerical calculation and find an efficient way to evaluate it. If analytical form does not exist, I really appreciate any alternative means for evaluating the integral. One method would be numerical quadrature including Gaussian quadrature, but it may be inefficient when the parameters $a$ and $b$ are very different in scale.  EDIT : In view of  discussion, we have decided to add OP's self-answer to the end of the question, for it does not qualify as an answer yet contains vital details. The copying is unabridged. Thanks very much for your comments, and the following result was obtained including the case for $x_0 \ne 0$: $$ \int_{-\infty}^{\infty} dx \exp[-a(x-x_0)^2] \frac{ \sin(bx) }{ x } = \pi \exp(-a x_0^2) \mathrm{Re}\left(\mathrm{erf}\left[\frac{b+2iax_0}{2\sqrt{a}}\right] - \mathrm{erf}\left[\frac{2iax_0}{2\sqrt{a}}\right]\right) $$ where $a\gt0, b, x_0$ are assumed to be all real. (note: coefficients etc may be still wrong...) This integral appears in a type of electronic structure calculation based on a grid representation (sinc-function basis). I believe the above result should be definitely useful. Thanks much!! --jaian If "clearly evident" is redundant, what word or phrase suggests being indisputable but not readily apparent? A  asks whether the modifier "clearly" changes the meaning of "evident". I would have said, prior to examining a few dictionaries, that evident did not necessarily mean readily apparent, but to my surprise it does.  This brings me to ask what word or expression would mean something can be taken as a true fact, but not through an easily constructed (not obvious or readily apparent) rationale?   For example, if Sherlock Holmes says something is true while everyone else is still sitting on their hands, then it is evident to Holmes, but not to the rest of the world. So, from everyone else's point of view, it is not readily apparent, and (by definition) apparently it is not evident, clear, or clearly evident at all, based on the dictionary definitions. But (let's stipulate) it is true and deducible from the observable evidence. What would we call this?  Update  An update is highlighted above. I can see from some of the answers and comments that I may have gone off my mark with the phrase "not through an easy-to-follow rationale”, and I have modified the question to correct this. I understand that there can be rationales, arguments, or proofs that, once explained, may or may not be easy to follow. What I intend is that the rationale to support the indisputable conclusion is not (initially) easy to recognize or construct (not readily apparent) in the first place. I apologize for the confusion. (The original can be seen in the change history.)  Update 2  Shortly after offering a bounty to this request, I recalled a single word that I now believe is a very good match to the parameters specified in this inquiry as it is stated above. That word has not yet been suggested (or approached) by any answer or comment (active or deleted) at the time of this edit. This request is changed to a single word request. (However, if you feel a single word fits well but not without some additional supporting words, please offer your thoughts in an answer.) While my curiosity for the term has already been met, the request and bounty remain as an open challenge. I will post my own answer once the bounty has expired and been awarded. The collection of all subsets of $\mathbb{Z}$ is uncountable, due to   But how can I prove that the collection of all finite subsets of $\mathbb{Z}$ is countable? $X$ is a Hausdorff space and $\sim$ is an equivalence relation.  If the quotient map is open, then $X/{\sim}$ is a Hausdorff space if and only if $\sim$ is a closed subset of the product space $X \times X$.  Necessity is obvious, but I don't know how to prove the other side. That is, $\sim$ is a closed subset of the product space $X \times X$ $\Rightarrow$ $X/{\sim}$ is a Hausdorff space. Any advices and comments will be appreciated. I have absolutely no experience with Linux, and I desperately need to get my computer back up and running again with Windows.  How do I remove Ubuntu and reinstall Windows?    Editor's note: many of the answers are about removing Ubuntu from dual-boot but keeping Windows (which is a bit complicated), while other answers are about removing Ubuntu from single-boot (which is easy: basically just format the disk while installing Windows). The question as written is ambiguous between dual-boot or single-boot. Login with Facebook using Stack Exchange Android App When will my device get the Android 5.0 update (Lollipop)? Every time I install a new Linux kernel, it gets left in the grub_config, making the boot menu longer each time.    I know I can manually search through the installed packages and remove them.  Does Ubuntu provide any easier way to clean them up or keep them from showing in the boot list? Ignore citations in captions in list of figures when numbering When using the \cite command in figure captions and the ieeetr bibliography style, then  BibTeX numbers the citations as appearing earlier than they do in reality (i.e. the first citation in the document ends up being [42]).  Is there any way to get BibTeX to ignore the \listoffigures section when numbering? Switches needed in an n-location multiway switching system we can construct a two location multiway switching system with two 3-way switches:    They also teach us how to perform three location multiway switching with two 3-way switches and one 4-way switch:    Is it possible to make a similar system (three locations, all able to switch the light in any situation) with only three 3-way switches?   What can be said in general about the switches needed to make an n-location multiway switching system? How can I remove launcher drive icons? How to show that this binomial sum satisfies the Fibonacci relation? The binomial sum   $$s_n=\binom{n+1}{0}+\binom{n}{1}+\binom{n-1}{2}+\cdots$$   satisfies the Fibonacci relation.   I failed to prove that $\binom{n-k+1}{k}=\binom{n-k}{k}+\binom{n-k-1}{k}$... Any hints or suggestions? Rotating an object continously with OnMouseDown I have a script that works but it does not do what I want it to do. My script makes an object rotate on when another is clicked. However, I want the object to continuously rotate until I click on the other object again. Right now when I click it rotates just a bit and stops.  Here is my script:   public class Rotate : MonoBehaviour {     public float speed =50f;     public GameObject target;      public void OnMouseDown(){        target.transform.Rotate (new Vector3(0, Time.deltaTime, 0) * speed);     }  }   How can I make the object rotate continuously until I click it again? Why is it important to override GetHashCode when Equals method is overridden?