code: public static String toValidFileName(String fileName) {
          // adds MAX_VALUE to eliminate minus character which might be returned by hashCode()
          return Long.toString((long) fileName.hashCode() + Integer.MAX_VALUE);
      }
docs: Converts characters of passed string and replaces to hash which can be treated as valid file name.
  
  @param fileName
  sequence that should be converted
  @return converted string