java: Convert a string which represents a two digit year to four digits
<p>This question has been asked many times but I have an issue which I feel makes it a unique question.</p>

<p>Here it goes.</p>

<p>I have a string which represents a two digit year i.e. to write 2016 I input 16</p>

<p>I have a requirement to convert a two digit year to four digit year i.e. 16 becomes 2016.</p>

<p>After going through some questions and answers I made the following findings</p>

<p><strong>Solution 1</strong></p>

<pre><code>DateFormat sdfp = new SimpleDateFormat("dd.mm.yy");
Date d = sdfp.parse(input);
DateFormat sdff = new SimpleDateFormat("yyyy-MM-dd");
String date = sdff.format(d);
</code></pre>

<p>This would be great but I do not have a month or day in my case just a year and I could not find a way to create a date object with just the year.</p>

<p><strong>Solution 2</strong></p>

<p>The above could be solved with a <code>Calendar</code> object but it does not allow the input an of a two digit year for its year field. </p>

<p><strong>Edit</strong>
Forgot to mention I cannot use Joda-Time because I'm working on the Android platform and it would increase the size of my project for just this small use</p>