If the value is 200.3456, it should be formatted to 200.34. If it is 200, then it should be 200.00.
What I would like is a method to convert a double to a string which rounds using the half-up method - i.e. if the decimal to be rounded is 5, it always rounds up to the next number. This is the standard method of rounding most people expect in most situations.  I also would like only significant digits to be displayed - i.e. there should not be any trailing zeroes.  I know one method of doing this is to use the String.format method:  String.format("%.5g%n", 0.912385);   returns:  0.91239   which is great, however it always displays numbers with 5 decimal places even if they are not significant:   String.format("%.5g%n", 0.912300);   returns:  0.91230   Another method is to use the DecimalFormatter:  DecimalFormat df = new DecimalFormat("#.#####"); df.format(0.912385);   returns:  0.91238   However as you can see this uses half-even rounding. That is it will round down if the previous digit is even. What I'd like is this:  0.912385 -&gt; 0.91239 0.912300 -&gt; 0.9123   What is the best way to achieve this in Java?
What is the integral of 0? How to generate the random default "gravatars" like on Stack Overflow? How does Stack Overflow auto-generate the gravatars for those users who do not upload a picture or who have not created a Gravatar icon?    Where do these random avatars come from, and how can I generate them for my own site? Are Windows file timestamps timezone aware? Which is correct: "the below information" or "the information below"? I frequently see statements that refer to something later in the text that use a phrase such as "the below information". Is it more correct instead to say "the information below" (or "the following information")? What is the meaning of "stop to do"? My teacher said that "stop to do" had two meanings: quit doing present work to do next work (which is following after the word "do") and pause for a while then continue. I have searched a lot about its meanings but what i got just about the first meaning. Is the second one true?  For examples:   I stop to play games.   First meaning: i stop doing something in order to play games.  Second meaning: i pause playing games for a while then i continue. I would like to prove the following equality: $$k^{\phi(l)} + l^{\phi(k)} \equiv1\pmod{lk}$$if $\gcd(l,k)=1$. What methods can I use? Thank you for your help. A week ago I  people on this site what mathematical background was needed for understanding Quantum Physics, and most of you mentioned Linear Algebra, so I decided to conduct a self-study of Linear Algebra. Of course, I'm just 1 week in, but I have some questions.    How is this going to be applicable to quantum physics? I have learned about matrices (addition, subtraction, multiplication and inversion) and about how to solve multiple equations with 3 unknowns using matrices, and now I am starting to learn about vectors. I am just 1 week in, so this is probably not even the tip of the iceberg, but I want to know how this is going to help me.  Also, say I master Linear Algebra in general in half a year (I'm in high school but I'm extremely fast with maths), what other 'types' of math would I need to self-study before being able to understand rudimentary quantum physics mathematically? How to run scripts without typing the full path? I'd like to know if there is a way to run  program/shell script without typing full path:  /opt/idea/bin/idea.sh How do I reboot a Ubuntu Server from the command line? sudo reboot now never seems to work for me. Because its a server, I don't have a window manager installed, so I can't do it from a GUI (which always seems to work).    I've had the problem for years on different versions of the operating system. It happens in virtual machines and on real metal. The same problem exists with sudo shutdown now, too.  I've lived with it in the past. The difference now is I don't want to just hit the power button because I might lose data. When speaking with my mother a couple of days ago, I read to her a message I was sending to my cousin on her behalf ending with: "... the birthday of your youngest." [implying her child]  She immediately leapt on this and said that as my cousin only had two children, the use of the superlative was not permitted and the comparative must be used instead: "... the birthday of your younger child."  She was adamant that this was a solid grammatical rule that she was taught throughout her education.  As a younger Briton, I have relatively little formal grammatical education to older people who were better taught in this regard, so I usually defer to her on grammatical rule knowledge.  Is she right?  Are superlatives not permitted when the domain of the object is only two?  To me it seems bizarre.  The minimum or maximum of any set does not only exist when there are different minima and maxima, or indeed something which is neither. Repost it with a minimal working example for the amsmath must be loaded earlier than mathspec problem I made up some integrals to do for fun, and I had a real problem with this one. I've since found out that there's no solution in terms of elementary functions, but when I attempt to integrate it, I end up with infinite values. Could somebody point out where I go wrong?  So, I'm trying to determine: $$ \int{\frac{e^x}{x}} \, dx $$  Integrate by parts, where $u = 1/x$, and $v \, ' = e^x$. Then $u \, ' = - 1/x^2$, and $v=e^x$. So,  $$\int{\frac{e^x}{x}} \, dx = \frac{e^x}{x} + \int{\frac{e^x}{x^2}} \, dx$$  Integrate by parts again, $u = 1/x^2$, $v \, ' = e^x$, so that $u \, ' = -2/x^3$ and $v=e^x$. So,  $$\int{\frac{e^x}{x}} \, dx = \frac{e^x}{x} + \frac{e^x}{x^2} + 2\int{\frac{e^x}{x^3}} \, dx$$  Repeat this process ad infinitum to get,  $$\int{\frac{e^x}{x}} \, dx = \frac{e^x}{x} + \frac{e^x}{x^2} + 2 \left( \frac{e^x}{x^3} + 3 \left( \frac{e^x}{x^4} + 4 \left( \frac{e^x}{x^5} + \, \cdots \right) \right) \right) $$  Expanding this gives,  $$\int{\frac{e^x}{x}} \, dx = \frac{e^x}{x} + \frac{e^x}{x^2} + \frac{2e^x}{x^3} + \frac{6 e^x}{x^4} + \frac{24 e^x}{x^5} + \cdots $$  And factoring that gives,  $$\int{\frac{e^x}{x}} \, dx = \frac{e^x}{x} \left(  1 + \frac{1}{x} + \frac{2}{x^2} + \frac{6}{x^3} + \frac{24}{x^4} + \cdots \right) $$  Now, considering the series itself, the ratio between the $n^{th}$ term and the $(n-1)^{th}$ term = $\Large \frac{n}{x}$. Eventually, $n$ will be larger than $x$, so the ratio between successive terms will be positive, so (assuming $x$ is positive), the series diverges, meaning (and I'm sure everybody will cringe upon seeing notation used like this), that:  $$\int{\frac{e^x}{x}} \, dx = \frac{e^x}{x} \left( \infty \right) = \infty $$ Can I have multiple Schengen visas for future travels in my passport? I'm a citizen of Ukraine planning on visiting Italy early in October for tourism. Later that month I'm accepted as a speaker at the conference in Prague, Czech Republic. Both countries are members of Schengen agreement and a visa is required for me to visit them. Therefore, I need to visit Schengen countries 2 times and I need to get my visas ASAP (to confirm my talk to the conference organizers, as well as to avoid overpaying for hotels/flight tickets).   I've heard a number of times that a single person can't apply for a Schengen visa if already in possession of one, but I'd like to clarify this. Say, I've got a visa from Italy for the period of October 1st - October 14th. Can I get another one from Czech Republic for October 25th - October 30th before I visit Italy? Would the answer be different if I were to visit the second country (CZ) on October 13th - October 20th, thus, having a single day overlap between these visits. It would be of a tremendous help if you could link to the official documents that prove your point, but I'd certainly appreciate answers even without such links.  Both times I'm going to apply for a short-term tourist visa covering the dates of my travel. If the answer to both questions above is no - would several visits to multiple Schengen countries over a short period of time be a valid reason to apply for a single multiple-entry visa that covers the whole period from October 1st to October 30th from Italy? What is the proper usage of "not only... but also"? I'm trying to figure out how to use "not only... but also" properly. Basically, my goal is to combine two clauses by using "not only".  For negations, I've figured out two styles that both sound correct:   He knew that if he fractures his finger, not only would he not be able to compete in the water polo tournament, he would not be able to take the SAT on Monday, either. He knew that if he fractures his finger, neither would he be able to compete in the water polo tournament, nor would he be able to take the SAT on Monday.   However, I don't know how to form a sentence that does not include a negation while using "not only". Here are a few possibilities that I've considered:   Thanks to his remarkable performance on the SAT, not only was he accepted into Harvard, but he was also given a full scholarship. Thanks to his remarkable performance on the SAT, not only was he accepted into Harvard, but he was given a full scholarship. Thanks to his remarkable performance on the SAT, not only was he accepted into Harvard, he was given a full scholarship. Thanks to his remarkable performance on the SAT, not only was he accepted into Harvard, he was also given a full scholarship.   In those four possibilities, I'm varying the usage of "but" and "also" in the last clause.  What is the proper usage of "not only"? How to limit zoom level in OpenLayers 2.x I would like to have only 3 levels of zoom available (from level 6 to level 8).  demolayer2 = new OpenLayers.Layer.WMS( "abc...","http://localhost:8080/geoserver/gwc/service/wms", {layers: 'def...', transparent:"true", format: 'image/png', numZoomLevels: 3, minZoomLevel: 6 },{isBaseLayer:false},  { tileSize: new OpenLayers.Size(256,256)});  map.addLayer(demolayer2);   map.addControl(new OpenLayers.Control.LayerSwitcher({'div':OpenLayers.Util.getElement('layerswitcher')}));  map.zoomToExtent(new OpenLayers.Bounds(-4.601615515076983,39.8769407866263,-3.0527184873294764,41.16710732525929)); Need help remembering sci-fi movie from the 90s maybe where someone is sabotaging the crew I saw this movie years ago and can't quite remember it. All I remember is there was a crew trapped in space and they're trying to survive but someone on the crew is sabotaging them. The drinking water gets poisoned so they have to drink their own urine. There's a man with a leg injury that he can't tell is getting really infected and bad because the saboteur gave him these injections that numb his leg.  That's pretty much all I can remember, so if anyone can help me with the title somehow, that would be amazing. Thanks! The relativistic energy-momentum equation is:  $$E^2 = (pc)^2 + (mc^2)^2.$$ Also, we have $pc = Ev/c$, so we get: $$E = mc^2/(1-v^2/c^2)^{1/2}.$$  Now, accelerating a proton to near the speed of light, I get the following results for the energy of proton:  0.990000000000000   c =&gt;    0.0000000011    J =      0.01    TeV  0.999000000000000   c =&gt;    0.0000000034    J =      0.02    TeV  0.999900000000000   c =&gt;    0.0000000106    J =      0.07    TeV  0.999990000000000   c =&gt;    0.0000000336    J =      0.21    TeV  0.999999000000000   c =&gt;    0.0000001063    J =      0.66    TeV  0.999999900000000   c =&gt;    0.0000003361    J =      2.10    TeV  0.999999990000000   c =&gt;    0.0000010630    J =      6.64    TeV 0.999999999000000   c =&gt;    0.0000033614    J =      20.98   TeV  0.999999999900000   c =&gt;    0.0000106298    J =      66.35   TeV  0.999999999990000   c =&gt;    0.0000336143    J =      209.83      TeV  0.999999999999000   c =&gt;    0.0001062989    J =      663.54      TeV  0.999999999999900   c =&gt;    0.0003360908    J =      2,097.94    TeV  0.999999999999990   c =&gt;    0.0010634026    J =      6,637.97    TeV  0.999999999999999   c =&gt;    0.0033627744    J =      20,991.10   TeV    If the LHC is accelerating protons to $7 TeV$ it means they're traveling with a speed of $0.99999999c$.  Is everything above correct? Add Virtualbox Shortcut in Unity Launcher to boot to a VM Can I create a shortcut to a virtualbox OS in the unity sidebar without it being on the desktop too.  I tried to right click in virtualbox and create shortcut on desktop then move it. but if i do it then delete the desktop shortcut it renders the unity shortcut useless.  Any ideas? Prove that $n=\dfrac{5^{125}-1}{5^{25}-1}$ is a composite number   My attempt,  Let $x=5^{25}$, so that $5^{125}-1=x^5-1=(x-1)(x^4+x^3+x^2+x+1)$  $=(x^4+9x^2+1+6x^3+6x+2x^2-5x^3-10x^2-5x)(x-1)$  $=((x^2+3x+1)^2-5x(x+1)^2)(x-1)$  I'm stuck at this point and don't know how to continue anymore. Hope someone can provide a detailed solution. Thanks a lot. How do I install Ubuntu as the only OS on a MacBook?  That is, I'd like to completely remove Mac OS X and install Ubuntu. I've tried dual-booting, but I've had so much trouble that I prefer to have only Ubuntu installed.