Here’s a way to impress your geek friends, or look really silly …
Below is Java code to convert a predefined New Year’s greeting into hexadecimal format.
Copyright 2012 James G. Willmore
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
* A geek way to usher in the New Year.
* @author James G. Willmore
public class GeekNewYear
public static void main(String args)
//we need a single argument containing only numbers
if(args.length != 1 || !args.matches("[0-9]+"))
System.out.println("This app works better if you provide a single year.");
Integer year = Integer.parseInt(args);
String greeting = "Happy New Year, " + year + "!";
String output = String.format("%022x", new BigInteger(greeting.getBytes()));
System.out.println(greeting + " converted to hexadecimal is " + output);
You can compile the code in your favorite command line / terminal window.
And run the application as follows and the following output is produced.