I'm having some trouble about crc-calculator with Hexadecimal value. In fact, I have this good code that calculate correctly with ASCII input.  But hexstring that I need to calculate "44007A0004 ... " cannot be converted to ASCII char. How I can change my function to calculate hex input string crc?    public String  CRC_CCITT( int flag,String str)  {             int crc = 0x00;          // initial value            int polynomial = 0x1021;               byte[] bytes = str.getBytes();      switch(flag){       case 1:           crc=0x00;           break;       case 2:           crc=0xFFFF;           break;       case 3:           crc=0x1D0F;           break;        }       for (int index = 0 ; index&lt; bytes.length; index++) {           byte b = bytes[index];           for (int i = 0; i &lt; 8; i++) {               boolean bit = ((b   &gt;&gt; (7-i) &amp; 1) == 1);               boolean c15 = ((crc &gt;&gt; 15    &amp; 1) == 1);               crc &lt;&lt;= 1;               if (c15 ^ bit) crc ^= polynomial;            }       }       crc &amp;= 0xffff;       str = Integer.toHexString(crc);       return str;             }
I am looking for a way to convert a long string (from a dump), that represents hex values into a byte array.  I couldn't have phrased it better than the person that posted .  But to keep it original, I'll phrase it my own way: suppose I have a string "00A0BF" that I would like interpreted as the  byte[] {0x00,0xA0,0xBf}   what should I do?  I am a Java novice and ended up using BigInteger and watching out for leading hex zeros. But I think it is ugly and I am sure I am missing something simple.
Change paper size in mid-document My document should be letterpaper and my attachments should be a4paper. I had high hopes for the \newgeometry command from the geometry package, but the documentation says      \newgeometry is almost similar to   \geometry except that \newgeometry   disables all the options specified in   the preamble and skips the   papersize-related options: landscape,   portrait and paper size options (such   as papersize, paper=a4paper and so   forth).   Any help is appreciated! Moving Around Other creatures      You can move through a nonhostile creature's space [but] you can't willingly end your move in its space.   Is that "end your move" at the end of your turn or if you stop to attack? I had a player who wanted to move into another friendly character's space, attack a hostile, then sidestep behind a wall. made me think about the movie versions of the 7th book.  In Deathly Hallows Part II      Voldemort has Nagini attack Snape because Voldy thinks that Snape has the Elder Wand's allegiance. We know that Snape didn't actually have the allegiance, Draco did (and by then Harry did) and his plan had failed.   But if Voldy's plan had succeeded with Snape, would he have gotten allegiance?      Since voldemort didn't kill Snape, Nagini did... Explain Root Mean Square Error to non-technical audience Why should the interface for a Java class be preferred? Can I use a charger with more output amperage than the device needs? What is meant by a "random variable"? What do they mean when they say "random variable"? How do I know when to use "the" versus "a" versus "∅" as an article on a noun? With proper nouns, we don't use the except for river names, newspaper names, etc.  I want to know why we use the with White House. I mean, under which rule can we categorize it? What could other similar examples for that rule be? Does javascript use immutable or mutable strings? Do I need a "string builder"? How to get glare on "Quick Smoke" (Fire & Smoke explosion) What happens when a caster targets an object that looks like a creature with a spell that targets only creatures? There are many spells which explicitly target creatures:     Choose one creature within range   The target creature is normally supposed to make a saving throw in this case.  What happens when the caster chooses a creature, that is actually an object? For instance, a scarecrow, a mannequin, an illusion, or a corpse.  Examples:   An evil mage is hiding in the bushes. He casts an illusion of himself on the road, using the Silent Image spell. A PC sorcerer walks down the road, sees the illusion and casts Magic Missile on it. A cleric is standing near a pile of dead bodies. He has suspicions that a few corpses are actually undead creatures. He casts Sacred Flame on every corpse, see which if them succeed, hence, reveals the undead. A wizard casts Acid Splash on a mannequin, trying to damage it with acid.   Possible outcomes I can think of are:   The caster cannot even try to cast the spell, regardless of their information about what the target actually is. The caster tries to cast the spell, the casting fails, not expending the spell slot. The caster casts the spell, it expends the spell slot, then fails. The caster casts the spell, but it hits the original and not the illusion. The caster casts the spell, it flies to the target illusion but deals no damage to it (passes through it).   References in the rules and Sage advice  I was trying to investigate, but it didn't make things clearer:    has an answer, that Magic Missile won't hit. It says nothing about if it can be targeted at all, it leaves it up to the DM. Magic Missile automatically finds the original, even when the caster targets an illusion. At least . Now . This supports the counter-intuitive option 4.   on the other hand   , if there were no perceivable effects (let's say you can try to cast the Command spell on an illusion). That assumes that casters can waste their spells on illusion, which means they at least can target it. This supports options 3 and 5. In D&amp;D 4e there was an option to Delay your initiative:     Perform your actions as desired and adjust your initiative to your new   position in the order.   Does this rule to change initiative order still exist in 5th edition? I cannot find it in the PHB. Suppose $G$ is a finer filter than $F$ in a topological space $X$.  Is the net base in $G$ a subnet of the net base in $F$?  I am using the definitions of General Topology of Willard:     Definition 12.15. If $(x_\lambda)$ is a net in $X$, the filter generated by the filter base $\mathscr C$ consisting of the sets $B_{\lambda_0}=\{x_\lambda; \lambda\ge\lambda_0\}$, $\lambda_0\in\Lambda$, is called the filter generated by $(x_\lambda)$.      Definition 12.16. If $\mathscr F$ is a filter on $X$, let $\Lambda_{\mathscr F}=\{(x,F); x\in F\in\mathscr F\}$.   Then $\Lambda_{\mathscr F}$ is directed by the relation $(x_1,F_1)\le(x_2,F_2)$ iff $F_2\subset F_1$, so the map   $P\colon \Lambda_{\mathscr F} \to X$ defined by $P(x,F)=x$ is a net in $X$. It is called the net based on $\mathscr F$.   The definition of subnet used in Willard is the second one from this post:   Thank you Rest mass of the photon Why is the rest mass of the photon is taken to be zero?  If rest mass of the photon is non zero, then it leads to infinite energy of the photon (by $E=mc^2$ equation) and there is a violation of conservation of energy. Is this a reason?  Also, is there any thing called the relativistic mass of the photon? Why is there no plural 's' after "hundred" or "thousand" in cardinal numbers? Let's say we have the numeral "12,345". Why is it pronounced as "twelve thousand three hundred and forty five" as opposed to "twelve thousands three hundreds and forty five". Are 's's omitted while pronouncing numerals to make the whole thing more succinct and easier to pronounce? What is a good Hash function? I saw a lot of hash function and applications in my data structures courses in college, but I mostly got that it's pretty hard to make a good hash function. As a rule of thumb to avoid collisions my professor said that:  function Hash(key)   return key mod PrimeNumber end   (mod is the % operator in C and similar languages)  with the prime number to be the size of the hash table. I get that is a somewhat good function to avoid collisions and a fast one, but how can I make a better one? Is there better hash functions for string keys against numeric keys? Is there a description of Stack Exchange/Stack Overflow sites? Turn off text message (SMS) sync to Exchange email account I recently started using a Samsung Galaxy S4 and one of the features in a synchronization between text messages and email accounts.  When a text message comes in it throws a copy into my Exchange email accounts that are one the phone. I want to turn this feature off but cannot find a setting for it anywhere.  Any ideas? Robot arm move a box What focal length lens do I need for photographing the moon?