code: private String writeClass(String name, byte[] bytes) throws IOException {
          name = name.replace('.','/');
          File dexFile = new File(String.format("%s/%s.dex", getDexDir(), name));
          if(dexFile.exists() && isReuseClassFiles()) {
              if (log.isTraceEnabled())
                  log.trace(String.format("Reused class [%s] from cache: %s", name, dexFile.getAbsolutePath()));
              return dexFile.getAbsolutePath();
          }
          FileOutputStream fos = null;
          try {
              //convert .class ==> .dex
              DexFile file = new DexFile(dex_options);
              DirectClassFile cf =
                      new DirectClassFile(bytes, name + ".class", cf_options.strictNameCheck);
  
              cf.setAttributeFactory(StdAttributeFactory.THE_ONE);
              cf.getMagic();
  
              file.add(CfTranslator.translate(cf, bytes, cf_options, dex_options, file));
  
              //write dex file to cache dir
              dexFile.getParentFile().mkdirs();
              if (dexFile.exists()) dexFile.delete();
              fos = new FileOutputStream(dexFile);
              file.writeTo(fos, null, false);
              if (log.isTraceEnabled())
                  log.trace(String.format("Wrote class [%s] to cache: %s", name, dexFile.getAbsolutePath()));
              return dexFile.getAbsolutePath();
          } finally {
              if(fos!=null) {
                  try {
                      fos.close();
                  } catch (IOException e) {}
              }
          }
      }
docs: Convert class to dex
  @param name class name
  @param bytes   classfile bytes
  @return  the dex file name