Here you can find the source of getCommitCounterStr(final long commitCounter)
Parameter | Description |
---|---|
commitCounter | The commit counter. |
public static String getCommitCounterStr(final long commitCounter)
//package com.java2s; /**/*from w w w . j av a 2s .co m*/ Copyright (C) SYSTAP, LLC 2006-2007. All rights reserved. Contact: SYSTAP, LLC 4501 Tower Road Greensboro, NC 27410 licenses@bigdata.com This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ import java.util.Formatter; public class Main { /** * Format the commit counter with leading zeros such that it will be * lexically ordered in the file system. * * @param commitCounter * The commit counter. * * @return The basename of the file consisting of the foramtted commit * counter with the appropriate leading zeros. */ public static String getCommitCounterStr(final long commitCounter) { final StringBuilder sb = new StringBuilder(21); final Formatter f = new Formatter(sb); f.format("%021d", commitCounter); f.flush(); f.close(); final String basename = sb.toString(); return basename; } }