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.

   -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

   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
      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] = {

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;