Example usage for java.lang Integer toString

List of usage examples for java.lang Integer toString

Introduction

In this page you can find the example usage for java.lang Integer toString.

Prototype

@HotSpotIntrinsicCandidate
public static String toString(int i) 

Source Link

Document

Returns a String object representing the specified integer.

Usage

From source file:eu.fbk.dkm.sectionextractor.WikipediaSectionTitlesExtractor.java

public static void main(String args[]) throws IOException {

    CommandLineWithLogger commandLineWithLogger = new CommandLineWithLogger();
    commandLineWithLogger.addOption(OptionBuilder.withArgName("file").hasArg()
            .withDescription("wikipedia xml dump file").isRequired().withLongOpt("wikipedia-dump").create("d"));
    commandLineWithLogger.addOption(OptionBuilder.withArgName("file").hasArg().withDescription("Filter file")
            .withLongOpt("filter").create("f"));
    commandLineWithLogger.addOption(OptionBuilder.withArgName("dir").hasArg().withDescription("output file")
            .isRequired().withLongOpt("output-file").create("o"));
    commandLineWithLogger.addOption(OptionBuilder.withArgName("int").hasArg()
            .withDescription("max depth (default " + MAX_DEPTH + ")").withLongOpt("max-depth").create("m"));
    commandLineWithLogger.addOption(OptionBuilder.withArgName("int").hasArg()
            .withDescription("max num of sections").withLongOpt("max-num").create("n"));
    commandLineWithLogger.addOption(new Option("l", "print titles"));

    commandLineWithLogger.addOption(OptionBuilder.withArgName("int").hasArg()
            .withDescription(/*from www .j  a v  a2s  .  c o  m*/
                    "number of threads (default " + AbstractWikipediaXmlDumpParser.DEFAULT_THREADS_NUMBER + ")")
            .withLongOpt("num-threads").create("t"));
    commandLineWithLogger.addOption(OptionBuilder.withArgName("int").hasArg()
            .withDescription("number of pages to process (default all)").withLongOpt("num-pages").create("p"));
    commandLineWithLogger.addOption(OptionBuilder.withArgName("int").hasArg()
            .withDescription("receive notification every n pages (default "
                    + AbstractWikipediaExtractor.DEFAULT_NOTIFICATION_POINT + ")")
            .withLongOpt("notification-point").create("b"));

    CommandLine commandLine = null;
    try {
        commandLine = commandLineWithLogger.getCommandLine(args);
        PropertyConfigurator.configure(commandLineWithLogger.getLoggerProps());
    } catch (Exception e) {
        System.exit(1);
    }

    int numThreads = Integer.parseInt(commandLine.getOptionValue("num-threads",
            Integer.toString(AbstractWikipediaXmlDumpParser.DEFAULT_THREADS_NUMBER)));
    int numPages = Integer.parseInt(commandLine.getOptionValue("num-pages",
            Integer.toString(AbstractWikipediaExtractor.DEFAULT_NUM_PAGES)));
    int notificationPoint = Integer.parseInt(commandLine.getOptionValue("notification-point",
            Integer.toString(AbstractWikipediaExtractor.DEFAULT_NOTIFICATION_POINT)));

    int configuredDepth = Integer
            .parseInt(commandLine.getOptionValue("max-depth", Integer.toString(MAX_DEPTH)));
    int maxNum = Integer.parseInt(commandLine.getOptionValue("max-num", "0"));
    boolean printTitles = commandLine.hasOption("l");

    HashSet<String> pagesToConsider = null;
    String filterFileName = commandLine.getOptionValue("filter");
    if (filterFileName != null) {
        File filterFile = new File(filterFileName);
        if (filterFile.exists()) {
            pagesToConsider = new HashSet<>();
            List<String> lines = Files.readLines(filterFile, Charsets.UTF_8);
            for (String line : lines) {
                line = line.trim();
                if (line.length() == 0) {
                    continue;
                }

                line = line.replaceAll("\\s+", "_");

                pagesToConsider.add(line);
            }
        }
    }

    File outputFile = new File(commandLine.getOptionValue("output-file"));
    ExtractorParameters extractorParameters = new ExtractorParameters(
            commandLine.getOptionValue("wikipedia-dump"), outputFile.getAbsolutePath());

    WikipediaExtractor wikipediaPageParser = new WikipediaSectionTitlesExtractor(numThreads, numPages,
            extractorParameters.getLocale(), outputFile, configuredDepth, maxNum, printTitles, pagesToConsider);
    wikipediaPageParser.setNotificationPoint(notificationPoint);
    wikipediaPageParser.start(extractorParameters);

    logger.info("extraction ended " + new Date());

}

From source file:Main.java

public static String int2string(int value) {
    return Integer.toString(value);
}

From source file:Main.java

public static String decodeToString(String data) {
    String string = Integer.toString(Integer.parseInt(data, 16));
    return string;
}

From source file:Main.java

public static String leadingZeroes(int number) {
    String temp = Integer.toString(number);
    if (temp.length() < 3) {
        int iterations = 3 - temp.length();
        for (int i = 0; i < iterations; i++) {
            temp = "0" + temp;
        }// w  w  w.java 2 s  .co  m
    }
    return temp;
}

From source file:Main.java

public static String getPuzzleMetaFile(String puzzleFile, int puzzleSize) {
    return puzzleFile + Integer.toString(puzzleSize) + ".meta";
}

From source file:Main.java

public static String getChargeLevel(Intent paramIntent) {
    return Integer.toString(paramIntent.getIntExtra("level", 0)) + "%";
}

From source file:Main.java

public static String normalizeMinute(int minute) {
    if (minute < 10) {
        return "0" + Integer.toString(minute);
    }/* ww w  .  ja v a 2s.c  o m*/

    return Integer.toString(minute);
}

From source file:Main.java

public static String IntToString_JAVA(int number) {
    return Integer.toString(number);
}

From source file:Main.java

private static void padInt(StringBuilder paramStringBuilder, int paramInt1, int paramInt2) {
    String str = Integer.toString(paramInt1);
    for (int i = paramInt2 - str.length(); i > 0; i--)
        paramStringBuilder.append('0');
    paramStringBuilder.append(str);/*from   w  w  w  . j a v a2 s.  co  m*/
}

From source file:Main.java

public static String formatHoursAndMinutes(int totalMinutes) {
    String minutes = Integer.toString(totalMinutes % 60);
    minutes = minutes.length() == 1 ? "0" + minutes : minutes;
    return (totalMinutes / 60) + ":" + minutes;
}