Convert binary data into java or c++ sourcecode for easy integration in your project, with the free sfk bin-to-src command for Windows, Mac OS X and Linux.

sfk bin-to-src [...] infile outfile namePrefix

create sourcefile containing a binary data block. the outfile
will contain variable definitions beginning with namePrefix.

options
   -java       create java source code output, default is C.
   -class      java: create a fully compilable class with a short
               demo source code how to write the data to a file.
   -pack       C source: compress data with a simple RLE scheme.
   -hex        C source: produce hex numbers instead of decimal.
   -append     do not overwrite output, but append to it.
   -recsize=n  java: define number of bytes per record used
               within the raw data. default is 500. higher values
               produce less records, which may help if you get
               a "code too large" error during java compile.

further commands
   sfk clipsrc   convert clipboard text to C    style source code
   sfk clipphp   convert clipboard text to PHP  style source code
   sfk clipjava  convert clipboard text to Java style source code
   ... add +toclip to copy converted result back to clipboard.

web reference
   http://stahlworks.com/sfk-bintosrc

examples
   sfk bin-to-src myimg.dat imgsrc.cpp img01
      create C source code containing content from myimg.dat.

   sfk bin-to-src -java -class myimg.dat imgdata.java imgdata
      create a Java class "imgdata" with myimg.dat content.
 
C++ example output: (reduced at "...")

   #define pic01_BLOCK_SIZE 1105
   
   static unsigned char pic01_abRawBlock[1105] = {
   255,216,255,224,0,16,74,70,73,70,0,1,1,1,0,96,0,96,0,0,
   255,219,0,67,0,4,3,3,4,3,3,4,4,4,4,5,5,4,5,7,11,7,7,6,6,
   7,14,10,10,8,11,16,14,17,17,16,14,16,15,18,20,26,22,18,
   ...
   15,84,235,10,161,46,224,39,191,140,210,163,56,135,203,
   255,217,
   };

Java example output: (reduced at "...")

   public static int pic01_BlockSize = 1105;
   static String pic01_RawBlock[] = {
   "\uffd8\uffe0\u0010\u4a46\u4946\u0001\u0101 ...",
   "\u3f02\ue4a9\ud54a\u2a65\u84b4\u8dde\ud7d4 ...",
   "\u581b\u06e2\ua9f2\u64e7\u56ac\u840d\u8419 ...",
   };

   public static byte[] pic01_getBlock() {
      int iout=0, nblen=pic01_BlockSize;
      char atmp[] = new char[500];
      byte aout[] = new byte[nblen];
      for (int i=0; i> 8);
            byte blo = (byte)(c >> 0);
            aout[iout++] = bhi;
            if (iout < nblen)
               aout[iout++] = blo;
         }
      }
      return aout;
   }