No need to reinvent the wheel
SimpleDateFormat sdf = new SimpleDateFormat("yyyy");
String year = sdf.format(new Date());
To take the locale into account use the constructor SimpleDateFormat("template", Locale)
SimpleDateFormat sdf = new SimpleDateFormat("yyyy", Locale.getDefault());