How to sort alphabet in TreeMap by descending Value in Java Let's say that I have a TreeMap Alphabet in Java:  Map&lt;String, Integer&gt; alphabet = new TreeMap&lt;String, Integer&gt;();  and we put the letter as a key and its number as a value in the map without sorting them at all:  alphabet.put("a", 1); alphabet.put("c", 3); alphabet.put("b", 2); alphabet.put("u", 21); alphabet.put("l", 12); . . . alphabet.put("y", 25); alphabet.put("z", 26);   And I want to order them by descending value (from 26 to 1). I want to print something like this:  z   26 y   25 x   24 . . . d   4 c   3 b   2 a   1   Could not find anything simple enough without overcomplicating the code for this specific example.  I will use this for just understanding the logic behind sorting Maps, so I can continue solving another task for homework. Thanks
Sort a Map by values I am relatively new to Java, and often find that I need to sort a Map&lt;Key, Value&gt; on the values.  Since the values are not unique, I find myself converting the keySet into an array, and sorting that array through array sort with a custom comparator that sorts on the value associated with the key.  Is there an easier way?
Compute $e^{e^z}$, where z is a complex number I am self-studying the MAT 67 linear algebra course and I got stuck at a problem in Chapter 2:     Compute the real and imaginary parts of $e^{e^z}$ for $z$ $\in$ $\Bbb C$.   I tried to expand it using Euler's formula but it seemed endless. Any help? SQL IN Clause 1000 item limit Word meaning the reverse of 'Xenophobia' Xenophobia refers to the irrational fear or hatred of foreigners. But recently I've seen people displaying (in newspaper articles and other places) an irrational fear or hatred of their own countrymen. Is there a word for that? Why *not* parse `ls` (and what to do instead)? What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? Transpose/Unzip Function (inverse of zip)? How to put a brace on the right, not left, to group cases? How can I get a brace on the right, not the left, to group cases, using cases? (I know actual cases look better with the brace on the left, but the items I need to group are not literally cases. They are a set of steps in an algorithm which I want to consider as an item.)  The following puts the brace on the left. All I need to do is to flip it to the right.  \begin{align} \begin{cases} a&amp;=bbb\\ c&amp;=ddddddd\\ e&amp;=ffffffffff \end{cases} \end{align}   Thanks for any help with this! I have a bunch of magnets (one of those game-board thingies) given to me when I was a school-going lad over 20 years ago, and the magnets feel just as strong as it was the day it was given.   As a corollary to this question , is there a way to determine how long a permanent magnet will remain a magnet?   Addendum: Would two magnets remain a magnet for a shorter duration if they were glued in close proximity with like poles facing each other? Abstraction VS Information Hiding VS Encapsulation Can you tell me what is the difference between abstraction and information hiding in software development?  I am confused. Abstraction hides detail implementation and information hiding abstracts whole details of something.  Update: I found a good answer for these three concepts.  for several citations taken from . Determining the characteristic of a field If $\mathbb{F}=\{ 0,1,x,y\}$ is a field with four elements, why is the characteristic 2?   In a field with four elements, the characteristic is 2 or 3(since it has to be a prime). Is there any way to determine precisely the characteristic of this field, and in general any finite field? I'm trying to install Ubuntu 12.10 alongside Windows 7 on my ASUS laptop and I'm new to all of this.   I'm using  the Ubuntu 12.10 64-bit ISO burned onto a CD.  The first time I tried to install it, Ubuntu said it did not detect any other OS, which meant I only had 4 options:   Erase disk and install Ubuntu (I don't want to do this) Encrypt new Ubuntu. Use LVM. Something else.   If I choose the Something else option, it brings me to the partition menu and says that I have 1 disk with free space of 750516Mb (750Gb), but that's not true because I have Windows 7.  I've already read through several questions and people have mentioned that you could only have 4 primary partitions. So I got hold of partition magic and removed my D: and E:, leaving me with primary C: partition and System reserved partition and a lot of unallocated space.  I restarted the laptop several times and booted the CD again and I got exactly the same as I did previously.  How do fix this problem and install Ubuntu alongside Windows 7?  EDIT 1  Here are my results for   sudo fdisk -l; echo; sudo parted -l; echo; mount; echo; df -h   WARNING: GPT (GUID Partition Table) detected on '/dev/sda'! The util fdisk doesn't support GPT. Use GNU Parted.   Disk /dev/sda: 750.2 GB, 750156374016 bytes 255 heads, 63 sectors/track, 91201 cylinders, total 1465149168 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes Disk identifier: 0x90050371     Device Boot      Start         End      Blocks   Id  System /dev/sda1   *        2048      206847      102400    7  HPFS/NTFS/exFAT /dev/sda2          206848   146368214    73080683+   7  HPFS/NTFS/exFAT  Warning: /dev/sda contains GPT signatures, indicating that it has a GPT table. However, it does not have a valid fake msdos partition table, as it should. Perhaps it was corrupted -- possibly by a program that doesn't understand GPT partition tables.  Or perhaps you deleted the GPT table, and are now using an msdos partition table.  Is this a GPT partition table? Yes/No?     After selecting YES  Yes/No? yes                                                                Error: The backup GPT table is corrupt, but the primary appears OK, so that will be used. OK/Cancel? How can I easily encrypt a file? Is there any simple (IE: right click in Nautilus) way to password protect a particular folder/file in Ubuntu? I've got a few files containing sensitive info and I'd much prefer that if/when I leave my computer alone, they aren't accidentally accessed by someone else.  The secruty does not have to be extremely tight. My only concern is that when family/friends come over, I don't really like the idea of them looking at my bank details, accounts or, you guessed it, porn collection.  A simple, effective way to let me put my machine in the hands of someone else knowing that said machine can not cause me embarresment is the sole reason why I'd like to see this in Ubuntu. Inline image alignment issue for app and mobile web How do I extend a List in Dart? Should I change the URLs in the XML sitemap after 301 redirecting them? I am using 301 redirects for all URLs.  Should I change sitemap URLs now?  The sitemap currently contains the following URLs:   example.com/cat/1.html example.com/cat/2.html example.com/cat/3.html   Should I change the sitemap's URLs to a new destination?   example.com/cat/year/1.html example.com/cat/year/2.html example.com/cat/year/3.html This problem is from a practice exam I was working on.     What is the cardinality of the quotient $\mathbb{Z}[x]/(x^2-3,2x+4)$ ?   Thoughts. If I find a ring that is easier to handle then this then I can go from there. So I think this is isomorphic to $\mathbb{Z}_2[x]/(x^2-3,x+2)$. And then I am stuck.  Am I correct so far? What should I be looking to do from here?  Thanks for your time and your answers. I'm trying to prove that if $\alpha(t)=(x(t),y(t))$ is a $C^2$ regular curve $(\alpha'\neq0)$ with constant and positive curvature, then $\alpha$ is on the circunference and if $\alpha$ is the circunference, then its curvature is constant.  I solved the second part since $\alpha$ is the circunference, then $\alpha(t)=(r\cos\theta,r\sin\theta)$, so $|\alpha'(t)|=r$, I need help in the first part.  Thanks a lot. Is it appropriate to buy a "thank you" gift for a PhD supervisor? $x^y+y^x>1$ for all $(x, y)\in \mathbb{R_+^2}$ Prove that $x^y+y^x&gt;1$ for all $(x, y)\in \mathbb{R_+^2}$. Scale and Rotate Stopped Working [2.8]