Index: src/main/java/org/apache/fontbox/ttf/TTFSubsetter.java
===================================================================
--- src/main/java/org/apache/fontbox/ttf/TTFSubsetter.java	(Revision 1666332)
+++ src/main/java/org/apache/fontbox/ttf/TTFSubsetter.java	(Arbeitskopie)
@@ -62,7 +62,7 @@
      *
      * @param ttf the font to be subset
      */
-    public TTFSubsetter(TrueTypeFont ttf) throws IOException
+    public TTFSubsetter(final TrueTypeFont ttf) throws IOException
     {
         this(ttf, null);
     }
@@ -73,7 +73,7 @@
      * @param ttf the font to be subset
      * @param tables optional tables to keep if present
      */
-    public TTFSubsetter(TrueTypeFont ttf, List<String> tables) throws IOException
+    public TTFSubsetter(final TrueTypeFont ttf, final List<String> tables) throws IOException
     {
         this.ttf = ttf;
         this.keepTables = tables;
@@ -91,7 +91,7 @@
     /**
      * Sets the prefix to add to the font's PostScript name.
      */
-    public void setPrefix(String prefix)
+    public void setPrefix(final String prefix)
     {
         this.prefix = prefix;
     }
@@ -101,9 +101,9 @@
      * 
      * @param unicode character code
      */
-    public void add(int unicode)
+    public void add(final int unicode)
     {
-        int gid = unicodeCmap.getGlyphId(unicode);
+        final int gid = unicodeCmap.getGlyphId(unicode);
         if (gid != 0)
         {
             uniToGID.put(unicode, gid);
@@ -116,9 +116,9 @@
      *
      * @param unicodeSet character code set
      */
-    public void addAll(Set<Integer> unicodeSet)
+    public void addAll(final Set<Integer> unicodeSet)
     {
-        for (int unicode : unicodeSet)
+        for (final int unicode : unicodeSet)
         {
             add(unicode);
         }
@@ -131,9 +131,9 @@
     {
         addCompoundReferences();
 
-        Map<Integer, Integer> newToOld = new HashMap<Integer, Integer>();
+        final Map<Integer, Integer> newToOld = new HashMap<Integer, Integer>();
         int newGID = 0;
-        for (int oldGID : glyphIds)
+        for (final int oldGID : glyphIds)
         {
             newToOld.put(newGID, oldGID);
             newGID++;
@@ -147,37 +147,37 @@
      * @return The file offset of the first TTF table to write.
      * @throws IOException Upon errors.
      */
-    private long writeFileHeader(DataOutputStream out, int nTables) throws IOException
+    private static long writeFileHeader(final DataOutputStream out, final int nTables) throws IOException
     {
         out.writeInt(0x00010000);
         out.writeShort(nTables);
         
-        int mask = Integer.highestOneBit(nTables);
-        int searchRange = mask * 16;
+        final int mask = Integer.highestOneBit(nTables);
+        final int searchRange = mask * 16;
         out.writeShort(searchRange);
         
-        int entrySelector = log2(mask);
+        final int entrySelector = log2(mask);
     
         out.writeShort(entrySelector);
         
         // numTables * 16 - searchRange
-        int last = 16 * nTables - searchRange;
+        final int last = 16 * nTables - searchRange;
         out.writeShort(last);
         
         return 0x00010000L + toUInt32(nTables, searchRange) + toUInt32(entrySelector, last);
     }
         
-    private long writeTableHeader(DataOutputStream out, String tag, long offset, byte[] bytes)
+    private static long writeTableHeader(final DataOutputStream out, final String tag, final long offset, final byte[] bytes)
             throws IOException 
     {
         long checksum = 0;
         for (int nup = 0, n = bytes.length; nup < n; nup++)
         {
-            checksum += ((long)bytes[nup] & 0xffL) << 24- nup % 4 *8;
+            checksum += (bytes[nup] & 0xffL) << 24- nup % 4 *8;
         }
         checksum &= 0xffffffffL;
 
-        byte[] tagbytes = tag.getBytes("US-ASCII");
+        final byte[] tagbytes = tag.getBytes("US-ASCII");
 
         out.write(tagbytes, 0, 4);
         out.writeInt((int)checksum);
@@ -188,9 +188,9 @@
         return toUInt32(tagbytes) + checksum + checksum + offset + bytes.length;
     }
 
-    private void writeTableBody(OutputStream os, byte[] bytes) throws IOException
+    private static void writeTableBody(final OutputStream os, final byte[] bytes) throws IOException
     {
-        int n = bytes.length;
+        final int n = bytes.length;
         os.write(bytes);
         if (n % 4 != 0)
         {
@@ -200,10 +200,10 @@
 
     private byte[] buildHeadTable() throws IOException
     {
-        ByteArrayOutputStream bos = new ByteArrayOutputStream();
-        DataOutputStream out = new DataOutputStream(bos);
+        final ByteArrayOutputStream bos = new ByteArrayOutputStream();
+        final DataOutputStream out = new DataOutputStream(bos);
 
-        HeaderTable h = ttf.getHeader();
+        final HeaderTable h = ttf.getHeader();
         writeFixed(out, h.getVersion());
         writeFixed(out, h.getFontRevision());
         writeUint32(out, 0); // h.getCheckSumAdjustment()
@@ -229,10 +229,10 @@
 
     private byte[] buildHheaTable() throws IOException
     {
-        ByteArrayOutputStream bos = new ByteArrayOutputStream();
-        DataOutputStream out = new DataOutputStream(bos);
+        final ByteArrayOutputStream bos = new ByteArrayOutputStream();
+        final DataOutputStream out = new DataOutputStream(bos);
 
-        HorizontalHeaderTable h = ttf.getHorizontalHeader();
+        final HorizontalHeaderTable h = ttf.getHorizontalHeader();
         writeFixed(out, h.getVersion());
         writeSInt16(out, h.getAscender());
         writeSInt16(out, h.getDescender());
@@ -255,7 +255,7 @@
         return bos.toByteArray();
     }
 
-    private boolean shouldCopyNameRecord(NameRecord nr)
+    private static boolean shouldCopyNameRecord(NameRecord nr)
     {
         return nr.getPlatformId() == NameRecord.PLATFORM_WINDOWS
                 && nr.getPlatformEncodingId() == NameRecord.ENCODING_WINDOWS_UNICODE_BMP
@@ -265,16 +265,16 @@
 
     private byte[] buildNameTable() throws IOException
     {
-        ByteArrayOutputStream bos = new ByteArrayOutputStream();
-        DataOutputStream out = new DataOutputStream(bos);
+        final ByteArrayOutputStream bos = new ByteArrayOutputStream();
+        final DataOutputStream out = new DataOutputStream(bos);
 
-        NamingTable name = ttf.getNaming();
+        final NamingTable name = ttf.getNaming();
         if (name == null || keepTables != null && !keepTables.contains("name"))
         {
             return null;
         }
 
-        List<NameRecord> nameRecords = name.getNameRecords();
+        final List<NameRecord> nameRecords = name.getNameRecords();
         int numRecords = 0;
         for (NameRecord record : nameRecords)
         {
@@ -292,14 +292,14 @@
             return null;
         }
 
-        byte[][] names = new byte[numRecords][];
+        final byte[][] names = new byte[numRecords][];
         int j = 0;
-        for (NameRecord record : nameRecords)
+        for (final NameRecord record : nameRecords)
         {
             if (shouldCopyNameRecord(record))
             {
-                int platform = record.getPlatformId();
-                int encoding = record.getPlatformEncodingId();
+                final int platform = record.getPlatformId();
+                final int encoding = record.getPlatformEncodingId();
                 String charset = "ISO-8859-1";
 
                 if (platform == CmapTable.PLATFORM_WINDOWS &&
@@ -335,7 +335,7 @@
 
         int offset = 0;
         j = 0;
-        for (NameRecord nr : nameRecords)
+        for (final NameRecord nr : nameRecords)
         {
             if (shouldCopyNameRecord(nr))
             {
@@ -361,10 +361,10 @@
 
     private byte[] buildMaxpTable() throws IOException
     {
-        ByteArrayOutputStream bos = new ByteArrayOutputStream();
-        DataOutputStream out = new DataOutputStream(bos);
+        final ByteArrayOutputStream bos = new ByteArrayOutputStream();
+        final DataOutputStream out = new DataOutputStream(bos);
 
-        MaximumProfileTable p = ttf.getMaximumProfile();
+        final MaximumProfileTable p = ttf.getMaximumProfile();
         writeFixed(out, 1.0);
         writeUint16(out, glyphIds.size());
         writeUint16(out, p.getMaxPoints());
@@ -387,14 +387,14 @@
 
     private byte[] buildOS2Table() throws IOException
     {
-        OS2WindowsMetricsTable os2 = ttf.getOS2Windows();
+        final OS2WindowsMetricsTable os2 = ttf.getOS2Windows();
         if (os2 == null || keepTables != null && !keepTables.contains("OS/2"))
         {
             return null;
         }
 
-        ByteArrayOutputStream bos = new ByteArrayOutputStream();
-        DataOutputStream out = new DataOutputStream(bos);
+        final ByteArrayOutputStream bos = new ByteArrayOutputStream();
+        final DataOutputStream out = new DataOutputStream(bos);
 
         writeUint16(out, os2.getVersion());
         writeSInt16(out, os2.getAverageCharWidth());
@@ -426,9 +426,9 @@
 
         out.write(os2.getAchVendId().getBytes("US-ASCII"));
 
-        Iterator<Entry<Integer, Integer>> it = uniToGID.entrySet().iterator();
+        final Iterator<Entry<Integer, Integer>> it = uniToGID.entrySet().iterator();
         it.next();
-        Entry<Integer, Integer> first = it.next();
+        final Entry<Integer, Integer> first = it.next();
 
         writeUint16(out, os2.getFsSelection());
         writeUint16(out, first.getKey());
@@ -443,12 +443,12 @@
         return bos.toByteArray();
     }
 
-    private byte[] buildLocaTable(long[] newOffsets) throws IOException
+    private static byte[] buildLocaTable(final long[] newOffsets) throws IOException
     {
-        ByteArrayOutputStream bos = new ByteArrayOutputStream();
-        DataOutputStream out = new DataOutputStream(bos);
+        final ByteArrayOutputStream bos = new ByteArrayOutputStream();
+        final DataOutputStream out = new DataOutputStream(bos);
 
-        for (long offset : newOffsets)
+        for (final long offset : newOffsets)
         {
             writeUint32(out, offset);
         }
@@ -471,20 +471,20 @@
         boolean hasNested;
         do
         {
-            GlyphTable g = ttf.getGlyph();
-            long[] offsets = ttf.getIndexToLocation().getOffsets();
-            InputStream is = ttf.getOriginalData();
+            final GlyphTable g = ttf.getGlyph();
+            final long[] offsets = ttf.getIndexToLocation().getOffsets();
+            final InputStream is = ttf.getOriginalData();
             Set<Integer> glyphIdsToAdd = null;
             try
             {
                 is.skip(g.getOffset());
                 long lastOff = 0L;
-                for (Integer glyphId : glyphIds)
+                for (final Integer glyphId : glyphIds)
                 {
-                    long offset = offsets[glyphId];
-                    long len = offsets[glyphId + 1] - offset;
+                    final long offset = offsets[glyphId];
+                    final long len = offsets[glyphId + 1] - offset;
                     is.skip(offset - lastOff);
-                    byte[] buf = new byte[(int)len];
+                    final byte[] buf = new byte[(int)len];
                     is.read(buf);
                     // rewrite glyphIds for compound glyphs
                     if (buf.length >= 2 && buf[0] == -1 && buf[1] == -1)
@@ -493,9 +493,9 @@
                         int flags;
                         do
                         {
-                            flags = ((int)buf[off] & 0xff) << 8 | buf[off + 1] & 0xff;
+                            flags = (buf[off] & 0xff) << 8 | buf[off + 1] & 0xff;
                             off +=2;
-                            int ogid = ((int)buf[off] & 0xff) << 8 | buf[off + 1] & 0xff;
+                            final int ogid = (buf[off] & 0xff) << 8 | buf[off + 1] & 0xff;
                             if (!glyphIds.contains(ogid))
                             {
                                 if (glyphIdsToAdd == null)
@@ -548,13 +548,13 @@
         } while (hasNested);
     }
 
-    private byte[] buildGlyfTable(long[] newOffsets) throws IOException
+    private byte[] buildGlyfTable(final long[] newOffsets) throws IOException
     {
-        ByteArrayOutputStream bos = new ByteArrayOutputStream();
+        final ByteArrayOutputStream bos = new ByteArrayOutputStream();
 
-        GlyphTable g = ttf.getGlyph();
-        long[] offsets = ttf.getIndexToLocation().getOffsets();
-        InputStream is = ttf.getOriginalData();
+        final GlyphTable g = ttf.getGlyph();
+        final long[] offsets = ttf.getIndexToLocation().getOffsets();
+        final InputStream is = ttf.getOriginalData();
         try
         {
             is.skip(g.getOffset());
@@ -564,15 +564,15 @@
             int newGid = 0;      // new GID in subset font
 
             // for each glyph in the subset
-            for (Integer gid : glyphIds)
+            for (final Integer gid : glyphIds)
             {
-                long offset = offsets[gid];
-                long length = offsets[gid + 1] - offset;
+                final long offset = offsets[gid];
+                final long length = offsets[gid + 1] - offset;
 
                 newOffsets[newGid++] = newOffset;
                 is.skip(offset - prevEnd);
 
-                byte[] buf = new byte[(int)length];
+                final byte[] buf = new byte[(int)length];
                 is.read(buf);
 
                 // detect glyph type
@@ -584,17 +584,17 @@
                     do
                     {
                         // flags
-                        flags = ((int)buf[off] & 0xff) << 8 | (int)buf[off + 1] & 0xff;
+                        flags = (buf[off] & 0xff) << 8 | buf[off + 1] & 0xff;
                         off += 2;
 
                         // glyphIndex
-                        int componentGid = ((int)buf[off] & 0xff) << 8 | (int)buf[off + 1] & 0xff;
+                        int componentGid = (buf[off] & 0xff) << 8 | buf[off + 1] & 0xff;
                         if (!glyphIds.contains(componentGid))
                         {
                             glyphIds.add(componentGid);
                         }
 
-                        int newComponentGid = getNewGlyphId(componentGid);
+                        final int newComponentGid = getNewGlyphId(componentGid);
                         buf[off]   = (byte)(newComponentGid >>> 8);
                         buf[off + 1] = (byte)newComponentGid;
                         off += 2;
@@ -630,7 +630,7 @@
                     if ((flags & 0x0100) == 0x0100)
                     {
                         // USHORT numInstr
-                        int numInstr = ((int)buf[off] & 0xff) << 8 | (int)buf[off + 1] & 0xff;
+                        int numInstr = (buf[off] & 0xff) << 8 | buf[off + 1] & 0xff;
                         off += 2;
 
                         // BYTE instr[numInstr]
@@ -655,7 +655,7 @@
                 // 4-byte alignment
                 if (newOffset % 4 != 0)
                 {
-                    int len = 4 - (int)(newOffset % 4);
+                    final int len = 4 - (int)(newOffset % 4);
                     bos.write(PAD_BUF, 0, len);
                     newOffset += len;
                 }
@@ -672,7 +672,7 @@
         return bos.toByteArray();
     }
 
-    private int getNewGlyphId(Integer oldGid)
+    private int getNewGlyphId(final Integer oldGid)
     {
         return glyphIds.headSet(oldGid).size();
     }
@@ -684,8 +684,8 @@
             return null;
         }
 
-        ByteArrayOutputStream bos = new ByteArrayOutputStream();
-        DataOutputStream out = new DataOutputStream(bos);
+        final ByteArrayOutputStream bos = new ByteArrayOutputStream();
+        final DataOutputStream out = new DataOutputStream(bos);
 
         // cmap header
         writeUint16(out, 0); // version
@@ -697,20 +697,20 @@
         writeUint32(out, 4 * 2 + 4); // offset
 
         // build Format 4 subtable (Unicode BMP)
-        Iterator<Entry<Integer, Integer>> it = uniToGID.entrySet().iterator();
+        final Iterator<Entry<Integer, Integer>> it = uniToGID.entrySet().iterator();
         it.next();
         Entry<Integer, Integer> lastChar = it.next();
         Entry<Integer, Integer> prevChar = lastChar;
         int lastGid = getNewGlyphId(lastChar.getValue());
 
-        int[] startCode = new int[uniToGID.size()];
-        int[] endCode = new int[uniToGID.size()];
-        int[] idDelta = new int[uniToGID.size()];
+        final int[] startCode = new int[uniToGID.size()];
+        final int[] endCode = new int[uniToGID.size()];
+        final int[] idDelta = new int[uniToGID.size()];
         int segCount = 0;
         while(it.hasNext())
         {
-            Entry<Integer, Integer> curChar2Gid = it.next();
-            int curGid = getNewGlyphId(curChar2Gid.getValue());
+            final Entry<Integer, Integer> curChar2Gid = it.next();
+            final int curGid = getNewGlyphId(curChar2Gid.getValue());
 
             // todo: need format Format 12 for non-BMP
             if (curChar2Gid.getKey() > 0xFFFF)
@@ -757,7 +757,7 @@
         segCount++;
 
         // write format 4 subtable
-        int searchRange = 2 * (int)Math.pow(2, Math.floor(log2(segCount)));
+        final int searchRange = 2 * (int)Math.pow(2, Math.floor(log2(segCount)));
         writeUint16(out, 4); // format
         writeUint16(out, 8 * 2 + segCount * 4*2); // length
         writeUint16(out, 0); // language
@@ -797,14 +797,14 @@
 
     private byte[] buildPostTable() throws IOException
     {
-        PostScriptTable post = ttf.getPostScript();
+        final PostScriptTable post = ttf.getPostScript();
         if (post == null || keepTables != null && !keepTables.contains("post"))
         {
             return null;
         }
 
-        ByteArrayOutputStream bos = new ByteArrayOutputStream();
-        DataOutputStream out = new DataOutputStream(bos);
+        final ByteArrayOutputStream bos = new ByteArrayOutputStream();
+        final DataOutputStream out = new DataOutputStream(bos);
 
         writeFixed(out, 2.0); // version
         writeFixed(out, post.getItalicAngle());
@@ -822,11 +822,11 @@
         writeUint16(out, glyphIds.size());
 
         // glyphNameIndex[numGlyphs]
-        Map<String, Integer> names = new TreeMap<String, Integer>();
-        for (int gid : glyphIds)
+        final Map<String, Integer> names = new TreeMap<String, Integer>();
+        for (final int gid : glyphIds)
         {
-            String name = post.getName(gid);
-            Integer macId = WGL4Names.MAC_GLYPH_NAMES_INDICES.get(name);
+            final String name = post.getName(gid);
+            final Integer macId = WGL4Names.MAC_GLYPH_NAMES_INDICES.get(name);
             if (macId != null)
             {
                 // the name is implicit, as it's from MacRoman
@@ -846,9 +846,9 @@
         }
 
         // names[numberNewGlyphs]
-        for (String name : names.keySet())
+        for (final String name : names.keySet())
         {
-            byte[] buf = name.getBytes(Charset.forName("US-ASCII"));
+            final byte[] buf = name.getBytes(Charset.forName("US-ASCII"));
             writeUint8(out, buf.length);
             out.write(buf);
         }
@@ -859,17 +859,17 @@
 
     private byte[] buildHmtxTable() throws IOException
     {
-        ByteArrayOutputStream bos = new ByteArrayOutputStream();
+        final ByteArrayOutputStream bos = new ByteArrayOutputStream();
 
-        HorizontalHeaderTable h = ttf.getHorizontalHeader();
-        HorizontalMetricsTable hm = ttf.getHorizontalMetrics();
+        final HorizontalHeaderTable h = ttf.getHorizontalHeader();
+        final HorizontalMetricsTable hm = ttf.getHorizontalMetrics();
         byte [] buf = new byte[4];
-        InputStream is = ttf.getOriginalData();
+        final InputStream is = ttf.getOriginalData();
         try
         {
             is.skip(hm.getOffset());
             long lastOff = 0;
-            for (Integer glyphId : glyphIds)
+            for (final Integer glyphId : glyphIds)
             {
                 // offset in original file
                 long off;
@@ -884,7 +884,7 @@
                 // skip over from last original offset
                 if (off != lastOff)
                 {
-                    long nskip = off-lastOff;
+                    final long nskip = off-lastOff;
                     if (nskip != is.skip(nskip))
                     {
                         throw new EOFException("Unexpected EOF exception parsing glyphId of hmtx table.");
@@ -891,7 +891,7 @@
                     }
                 }
                 // read left side bearings only, if we are beyond numOfHMetrics
-                int n = glyphId < h.getNumberOfHMetrics() ? 4 : 2;
+                final int n = glyphId < h.getNumberOfHMetrics() ? 4 : 2;
                 if (n != is.read(buf, 0, n))
                 {
                     throw new EOFException("Unexpected EOF exception parsing glyphId of hmtx table.");
@@ -914,29 +914,29 @@
      * @param os the stream used for writing
      * @throws IOException if something went wrong.
      */
-    public void writeToStream(OutputStream os) throws IOException
+    public void writeToStream(final OutputStream os) throws IOException
     {
         addCompoundReferences();
 
-        DataOutputStream out = new DataOutputStream(os);
+        final DataOutputStream out = new DataOutputStream(os);
         try 
         {
-            long[] newLoca = new long[glyphIds.size() + 1];
+            final long[] newLoca = new long[glyphIds.size() + 1];
 
             // generate tables in dependency order
-            byte[] head = buildHeadTable();
-            byte[] hhea = buildHheaTable();
-            byte[] maxp = buildMaxpTable();
-            byte[] name = buildNameTable();
-            byte[] os2  = buildOS2Table();
-            byte[] glyf = buildGlyfTable(newLoca);
-            byte[] loca = buildLocaTable(newLoca);
-            byte[] cmap = buildCmapTable();
-            byte[] hmtx = buildHmtxTable();
-            byte[] post = buildPostTable();
+            final byte[] head = buildHeadTable();
+            final byte[] hhea = buildHheaTable();
+            final byte[] maxp = buildMaxpTable();
+            final byte[] name = buildNameTable();
+            final byte[] os2  = buildOS2Table();
+            final byte[] glyf = buildGlyfTable(newLoca);
+            final byte[] loca = buildLocaTable(newLoca);
+            final byte[] cmap = buildCmapTable();
+            final byte[] hmtx = buildHmtxTable();
+            final byte[] post = buildPostTable();
 
             // save to TTF in optimized order
-            Map<String, byte[]> tables = new TreeMap<String, byte[]>();
+            final Map<String, byte[]> tables = new TreeMap<String, byte[]>();
             if (os2 != null)  { tables.put("OS/2", os2); }
             if (cmap != null) { tables.put("cmap", cmap); }
             if (glyf != null) { tables.put("glyf", glyf); }
@@ -949,10 +949,10 @@
             if (post != null) { tables.put("post", post); }
 
             // copy all other tables
-            for (Map.Entry<String, TTFTable> entry : ttf.getTableMap().entrySet())
+            for (final Map.Entry<String, TTFTable> entry : ttf.getTableMap().entrySet())
             {
-                String tag = entry.getKey();
-                TTFTable table = entry.getValue();
+                final String tag = entry.getKey();
+                final TTFTable table = entry.getValue();
 
                 if (!tables.containsKey(tag) && (keepTables == null || keepTables.contains(tag)))
                 {
@@ -963,7 +963,7 @@
             // calculate checksum
             long checksum = writeFileHeader(out, tables.size());
             long offset = 12L + 16L * tables.size();
-            for (Map.Entry<String, byte[]> entry : tables.entrySet())
+            for (final Map.Entry<String, byte[]> entry : tables.entrySet())
             {
                 checksum += writeTableHeader(out, entry.getKey(), offset, entry.getValue());
                 offset += (entry.getValue().length + 3) / 4 * 4;
@@ -986,57 +986,57 @@
         }
     }
 
-    private void writeFixed(DataOutputStream out, double f) throws IOException
+    private static void writeFixed(final DataOutputStream out, final double f) throws IOException
     {
-        double ip = Math.floor(f);
-        double fp = (f-ip) * 65536.0;
+        final double ip = Math.floor(f);
+        final double fp = (f-ip) * 65536.0;
         out.writeShort((int)ip);
         out.writeShort((int)fp);
     }
 
-    private void writeUint32(DataOutputStream out, long l) throws IOException
+    private static void writeUint32(final DataOutputStream out, final long l) throws IOException
     {
         out.writeInt((int)l);
     }
 
-    private void writeUint16(DataOutputStream out, int i) throws IOException
+    private static void writeUint16(final DataOutputStream out, final int i) throws IOException
     {
         out.writeShort(i);
     }
 
-    private void writeSInt16(DataOutputStream out, short i) throws IOException
+    private static void writeSInt16(final DataOutputStream out, final short i) throws IOException
     {
         out.writeShort(i);
     }
 
-    private void writeUint8(DataOutputStream out, int i) throws IOException
+    private static void writeUint8(final DataOutputStream out, final int i) throws IOException
     {
         out.writeByte(i);
     }
 
-    private void writeLongDateTime(DataOutputStream out, Calendar calendar) throws IOException
+    private static void writeLongDateTime(final DataOutputStream out, final Calendar calendar) throws IOException
     {
         // inverse operation of TTFDataStream.readInternationalDate()
-        GregorianCalendar cal = new GregorianCalendar( 1904, 0, 1 );
-        long millisFor1904 = cal.getTimeInMillis();
-        long secondsSince1904 = (calendar.getTimeInMillis() - millisFor1904) / 1000L;
+        final GregorianCalendar cal = new GregorianCalendar( 1904, 0, 1 );
+        final long millisFor1904 = cal.getTimeInMillis();
+        final long secondsSince1904 = (calendar.getTimeInMillis() - millisFor1904) / 1000L;
         out.writeLong(secondsSince1904);
     }
 
-    private long toUInt32(int high, int low)
+    private static long toUInt32(final int high, final int low)
     {
-        return ((long)high & 0xffffL) << 16 | (long)low & 0xffffL;
+        return (high & 0xffffL) << 16 | low & 0xffffL;
     }
 
-    private long toUInt32(byte[] bytes)
+    private static long toUInt32(final byte[] bytes)
     {
-        return ((long)bytes[0] & 0xffL) << 24 |
-               ((long)bytes[1] & 0xffL) << 16 |
-               ((long)bytes[2] & 0xffL) << 8 |
-                (long)bytes[3] & 0xffL;
+        return (bytes[0] & 0xffL) << 24 |
+               (bytes[1] & 0xffL) << 16 |
+               (bytes[2] & 0xffL) << 8 |
+                bytes[3] & 0xffL;
     }
 
-    private int log2(int num)
+    private static int log2(final int num)
     {
         return (int)Math.round(Math.log(num) / Math.log(2));
     }
