public File stemming(File[] fileList)
    {
        PorterStemmer s = new PorterStemmer();
        File stemLocation = null;
        for (int i = 0; i < fileList.length; i++) 
        {
            numOfDocs += 1;
          try 
          {
            InputStream in = new FileInputStream(fileList[i]);
            stemLocation = new File(locationPath + "\\stemmedData");
            stemLocation.mkdir();
            bw = new BufferedWriter(new FileWriter(stemLocation + "\\data-" + i + ".txt"));
            byte[] buffer = new byte[1024];
            int bufferLen, offset, ch;
            bufferLen = in.read(buffer);
            offset = 0;
            s.reset();
            while(true) 
            {
              if (offset < bufferLen)
                ch = buffer[offset++];
              else {
                bufferLen = in.read(buffer);
                offset = 0;
                if (bufferLen < 0)
                  ch = -1;
                else
                  ch = buffer[offset++];
              }
              if (Character.isLetter((char) ch)) 
              {
                s.add(Character.toLowerCase((char) ch));
              }
              else 
              {
                 s.stem();
                 //System.out.print(s.toString());
                 bw.write(s.toString());
                 s.reset();
                 if (ch < 0)
                   break;
                 else {
                   //System.out.print((char) ch);
                     bw.write((char)ch);
                 }
               }
            }
            in.close();         
            bw.close();
          }
          catch (IOException e) 
          {
            //System.out.println("error reading " + fileList[i]);
              e.printStackTrace();
          }
          catch(Exception ex)
          {
              ex.printStackTrace();
          }          
        }    
        return stemLocation;
        }