public static void writeToFile(String content,String fileName) throws IOException {
  FileWriter fw=null;
  try {
    fw=new FileWriter(fileName);
    fw.write(content,0,content.length());
  }
  finally {
    if (fw != null) {
      fw.close();
    }
  }
}

public static void writeToFile ( String content , String fileName ) throws IOException { FileWriter fw = null ; try { fw = new FileWriter ( fileName ) ; fw . write ( content , 0 , content . length ( ) ) ; } finally { if ( fw != null ) { fw . close ( ) ; } } }
writes content to a file .
