How to split a string in Java

<p>I have a string, <span class="inlinecode">&#34;004-034556&#34;</span> , that I want to split into two strings:</p> <pre><code>string1=004 string2=034556 </code></pre> <p>That means the first string will contain the characters before <span clas

How to parse JSON in Java

<p>I have the following JSON text that I need to parse to get <span class="inlinecode">pageName</span> , <span class="inlinecode">pagePic</span> , <span class="inlinecode">post_id</span> , etc.</p> <p>What is the required code?</p> <pre><code>{

Converting JSON to Java

<p>I want to be able to access properties from a JSON string within my Java action method. The string is available by simply saying <span class="inlinecode">myJsonString = object.getJson()</span> . Below is an example of what the string can look lik

Increase heap size in Java

<p>I am working on a Windows 2003 server (64-bit) with 8 GB RAM. How can I increase the heap memory maximum? I am using the <span class="inlinecode">-Xmx1500m</span> flag to increase the heap size to 1500 Mb. Can I increase the heap memory to 75% of

Decode Base64 data in Java

<p>I have an image that is Base64 encoded. What is the best way to decode that in Java? Hopefully using only the libraries included with Sun Java 6.</p> <p><br><br><br><h1>Answer</h1> As of v6, Java SE ships with JAXB. <a href="http://download.oracl

Getting A File's Mime Type In Java

<p>I was just wondering how most people fetch a mime type from a file in Java? So far I&rsquo;ve tried two utils: <span class="inlinecode">JMimeMagic</span> &amp; <span class="inlinecode">Mime-Util</span> .</p> <p>The first gave me memory excepti