Compact Class For Java – CCFormat


Compact Class is a collection of common functions and classes that can make your code more concise, fast, and precise.

utility

Class CCFormat

java.lang.Object

extended by

utility.CCFormat

public class CCFormatextends java.lang.Object

CCFormat is a collection method for formatting numbers, convert the object
into a string and vice versa, as well as manipulate the date, time, and
string.

Since:
10.03.17
Version:
12.03.17
Author:
Yosua Onesimus


Field Detail

FRACTION_DIGITS

public static int FRACTION_DIGITS
FRACTION_DIGITS = 2

INF_OR_NAN_IS_ALLOWED

public static boolean INF_OR_NAN_IS_ALLOWED
INF_OR_NAN_IS_ALLOWED = true

NULL_IS_ALLOWED

public static boolean NULL_IS_ALLOWED
NULL_IS_ALLOWED = true

DICT_TERBILANG

public static java.util.HashMap DICT_TERBILANG
DICT_TERBILANG

DICT_SPELL_OUT

public static java.util.HashMap DICT_SPELL_OUT
DICT_SPELL_OUT

DICT_BILL

public static java.util.List<java.lang.Integer> DICT_BILL
DICT_BILL

FORMAT_DATE_4VIEW

public static final java.lang.String FORMAT_DATE_4VIEW
FORMAT_DATE_4VIEW = “dd-MMM-yyyy”
See Also:
Constant Field Values

FORMAT_TIME_4VIEW

public static final java.lang.String FORMAT_TIME_4VIEW
FORMAT_TIME_4VIEW = “HH:mm”
See Also:
Constant Field Values

FORMAT_DATE

public static final java.lang.String FORMAT_DATE
FORMAT_DATE = “dd/MM/yyyy”
See Also:
Constant Field Values

FORMAT_TIME

public static final java.lang.String FORMAT_TIME
FORMAT_TIME = “HH:mm:ss”
See Also:
Constant Field Values

FORMAT_DATE_TIME

public static final java.lang.String FORMAT_DATE_TIME
FORMAT_DATE_TIME = FORMAT_DATE + ” ” + FORMAT_TIME
See Also:
Constant Field Values

FORMAT_MYSQL

public static final java.lang.String FORMAT_MYSQL
FORMAT_MYSQL = “yyyy-MM-dd HH:mm:ss”
See Also:
Constant Field Values

FORMAT_yyyyMMdd

public static final java.lang.String FORMAT_yyyyMMdd
FORMAT_yyyyMMdd = “yyyyMMdd”
See Also:
Constant Field Values

FORMAT_yyyyMMddHHmm

public static final java.lang.String FORMAT_yyyyMMddHHmm
FORMAT_yyyyMMddHHmm = FORMAT_yyyyMMdd + “HHmm”
See Also:
Constant Field Values

FORMAT_yyyyMMddHHmmss

public static final java.lang.String FORMAT_yyyyMMddHHmmss
FORMAT_yyyyMMddHHmmss = FORMAT_yyyyMMddHHmm + “ss”
See Also:
Constant Field Values

FORMAT_yyMMddHHmmssSS

public static final java.lang.String FORMAT_yyMMddHHmmssSS
FORMAT_yyMMddHHmmssSS = “yyMMddHHmmssSS”
See Also:
Constant Field Values

FORMAT_EEE

public static final java.lang.String FORMAT_EEE
FORMAT_EEE = “EEE”
See Also:
Constant Field Values

FORMAT_EEEE

public static final java.lang.String FORMAT_EEEE
FORMAT_EEEE = “EEEE”
See Also:
Constant Field Values

FORMAT_WEEK_IN_YEAR

public static final java.lang.String FORMAT_WEEK_IN_YEAR
FORMAT_WEEK_IN_YEAR = “w”
See Also:
Constant Field Values

FORMAT_WEEK_IN_MONTH

public static final java.lang.String FORMAT_WEEK_IN_MONTH
FORMAT_WEEK_IN_MONTH = “W”
See Also:
Constant Field Values

FORMAT_MMM

public static final java.lang.String FORMAT_MMM
FORMAT_MMM = “MMM”
See Also:
Constant Field Values

FORMAT_MMMM

public static final java.lang.String FORMAT_MMMM
FORMAT_MMMM = “MMMM”
See Also:
Constant Field Values

FORMAT_yyyy

public static final java.lang.String FORMAT_yyyy
FORMAT_yyyy = “yyyy”
See Also:
Constant Field Values

FORMAT_MM_yyyy

public static final java.lang.String FORMAT_MM_yyyy
FORMAT_MM_yyyy = “MM yyyy”
See Also:
Constant Field Values

FORMAT_MMM_yyyy

public static final java.lang.String FORMAT_MMM_yyyy
FORMAT_MMM_yyyy = FORMAT_MMM + ” ” + FORMAT_yyyy
See Also:
Constant Field Values

FORMAT_MMMM_yyyy

public static final java.lang.String FORMAT_MMMM_yyyy
FORMAT_MMMM_yyyy = FORMAT_MMMM + ” ” + FORMAT_yyyy
See Also:
Constant Field Values

FORMAT_dd_MM_yyyy

public static final java.lang.String FORMAT_dd_MM_yyyy
FORMAT_dd_MM_yyyy = “dd ” + FORMAT_MM_yyyy
See Also:
Constant Field Values

FORMAT_dd_MMM_yyyy

public static final java.lang.String FORMAT_dd_MMM_yyyy
FORMAT_dd_MMM_yyyy = “dd ” + FORMAT_MMM_yyyy
See Also:
Constant Field Values

FORMAT_dd_MMMM_yyyy

public static final java.lang.String FORMAT_dd_MMMM_yyyy
FORMAT_dd_MMMM_yyyy = “dd ” + FORMAT_MMMM_yyyy
See Also:
Constant Field Values

FORMAT_HH_mm

public static final java.lang.String FORMAT_HH_mm
FORMAT_HH_mm = “HH:mm”
See Also:
Constant Field Values


Constructor Detail

CCFormat

public CCFormat()


Method Detail

getLocale

public static java.util.Locale getLocale()
Returns:
LOCALE

setLocale

public static void setLocale(java.util.Locale locale)
Parameters:
locale

formatCurrency

public static java.lang.String formatCurrency(java.lang.Number number,
                                              int fractionDigits)
Formats a number to produce a string.

 

Parameters:
number– The number to format.
fractionDigits – the number of fraction digits to be shown.

 

Returns:string with currency format for the current default locale.


formatCurrency

public static java.lang.String formatCurrency(java.lang.Number number)
Formats a number to produce a string.
Same as :
 formatCurrency(number, FRACTION_DIGITS);

 

Parameters:
number – The number to format.

 

Returns:string with currency format for the current default locale.


formatInteger

public static java.lang.String formatInteger(java.lang.Number number,
                                             int fractionDigits)
Formats a number to produce a string.

 

Parameters:
number– The number to format.
fractionDigits – the number of fraction digits to be shown.

 

Returns:string with integer number format for the current default locale.


formatInteger

public static java.lang.String formatInteger(java.lang.Number number)
Formats a number to produce a string.
Same as :
 formatInteger(number, FRACTION_DIGITS);

 

Parameters:
number – The number to format.

 

Returns:string with integer number format for the current default locale.


formatNumber

public static java.lang.String formatNumber(java.lang.Number number,
                                            int fractionDigits)
Formats a number to produce a string.

 

Parameters:
number– number The number to format.
fractionDigits – the number of fraction digits to be shown.

 

Returns:string with general-purpose number format for the current default
locale.


formatNumber

public static java.lang.String formatNumber(java.lang.Number number)
Formats a number to produce a string.
Same as :
 formatNumber(number, FRACTION_DIGITS);

 

Parameters:
number – number The number to format.

 

Returns:string with general-purpose number format for the current default
locale.


formatPercent

public static java.lang.String formatPercent(java.lang.Number number,
                                             int fractionDigits)
Formats a number to produce a string.

 

Parameters:
number– number number The number to format.
fractionDigits – the number of fraction digits to be shown.

 

Returns:string with percentage format for the current default locale.


formatPercent

public static java.lang.String formatPercent(java.lang.Number number)
Formats a number to produce a string.
Same as :
 formatPercent(number, FRACTION_DIGITS);

 

Parameters:
number – number number The number to format.

 

Returns:string with percentage format for the current default locale.


removeFormatCurrency

public static double removeFormatCurrency(java.lang.String source)
Parses text from the beginning of the given string to produce a number.
The method may not use the entire text of the given string.

 

Parameters:
source – A String whose beginning should be parsed.

 

Returns:the value of the specified number as a double. This may involve
rounding.


removeFormatInteger

public static double removeFormatInteger(java.lang.String source)
Parses text from the beginning of the given string to produce a number.
The method may not use the entire text of the given string.

 

Parameters:
source – A String whose beginning should be parsed.

 

Returns:the value of the specified number as a double. This may involve
rounding.


removeFormatNumber

public static double removeFormatNumber(java.lang.String source)
Parses text from the beginning of the given string to produce a number.
The method may not use the entire text of the given string.

 

Parameters:
source – A String whose beginning should be parsed.

 

Returns:the value of the specified number as a double. This may involve
rounding.


formatDecimal

public static java.lang.String formatDecimal(java.lang.Number number,
                                             int fractionDigits)
Formats a number to produce a string, but without grouping.

 

Parameters:
number– number The number to format.
fractionDigits – the number of fraction digits to be shown.

 

Returns:string with general-purpose number format for the current default
locale.


formatDecimal

public static java.lang.String formatDecimal(java.lang.Number number)
Formats a number to produce a string, but without grouping.
Same as
:
 formatDecimal(number, FRACTION_DIGITS);

 

Parameters:
number – number The number to format.

 

Returns:string with general-purpose number format for the current default
locale.


formatNumeric

public static java.lang.String formatNumeric(java.lang.Number number)
Formats a number to produce a string, but without grouping and without
fraction digits.

 

Parameters:
number – number number The number to format.

 

Returns:string with general-purpose number format for the current default
locale.


reformatNumber

public static java.lang.String reformatNumber(java.lang.String source)
Remove format number then format number again.
Same as :
 formatNumber(removeFormatNumber(source));

 

Parameters:
source – string with general-purpose number format for the current
default locale.

 

Returns:string with general-purpose number format for the current default
locale.


getString

public static java.lang.String getString(java.lang.Object object)
Returns the string representation of the Object argument.

 

Parameters:
object – an Object.

 

Returns:if the argument is null, then a string equal to “null”;
otherwise, the value of obj.toString() is returned.


getString4View

public static java.lang.String getString4View(java.lang.Object object)
Returns the string representation of the Object argument.

 

Parameters:
object – an Object.

 

Returns:the string representation of the Object argument.


getStringOrNull

public static java.lang.String getStringOrNull(java.lang.Object object)
Return String or null.
Same as :
 isNull(object) ? null : getString(object);

 

Parameters:
object – an Object.

 

Returns:the string representation of the Object argument.


getStringOrBlank

public static java.lang.String getStringOrBlank(java.lang.Object object)
Return String or empty String.
Same as :
 isNull(object) ? "" : getString(object);

 

Parameters:
object – an Object.

 

Returns:the string representation of the Object argument.


getDigit

public static java.lang.String getDigit(java.lang.Object object)
Parameters:
object – an Object.

Returns:A copy of this string with digit only.


getNonDigit

public static java.lang.String getNonDigit(java.lang.Object object)
Parameters:
object – an Object.

Returns:A copy of this string with non-digit only.


trimAll

public static java.lang.String trimAll(java.lang.String string)
Parameters:
string

Returns:A copy of this string with double white space removed.


toSentenceCase

public static java.lang.String toSentenceCase(java.lang.String string,
                                              boolean... options)
Converts all of the characters in this String to sentence case using the
rules of the default locale.

 

Parameters:
string
options

  • [0]: isTitleCase (default: false)
  • [1]:
    toLowerCase (default: true)
Returns:
the String, converted to sentence case.

 


toTitleCase

public static java.lang.String toTitleCase(java.lang.String string)
Converts all of the characters in this String to title case using the
rules of the default locale. Same as :
 toSentenceCase(string, true);

 

Parameters:
string

 

Returns:the String, converted to title case.


toHumanizeCase

public static java.lang.String toHumanizeCase(java.lang.String string)
Parameters:
string

Returns:humanizeCase


toUnderscoresCase

public static java.lang.String toUnderscoresCase(java.lang.String string)
Parameters:
string

Returns:underscoresCase


wordWrap

public static java.lang.String wordWrap(java.lang.String string,
                                        boolean isCenter)
Parameters:
string
isCenter

Returns:string with html format.


wordWrap

public static java.lang.String wordWrap(java.lang.String string)
Same as :
 wordWrap(string, true);

 

Parameters:
string

 

Returns:string with html format.


wordWrap

public static java.lang.String wordWrap(java.lang.String[] arrayString,
                                        boolean isCenter)
Parameters:
arrayString
isCenter

Returns:string with html format.


wordWrap

public static java.lang.String wordWrap(java.lang.String[] arrayString)
Same as :
 wordWrap(arrayString, true);

 

Parameters:
arrayString

 

Returns:string with html format.


pack

public static java.lang.String pack(java.lang.String string,
                                    java.lang.String filler,
                                    int length)
Parameters:
string
filler
length

Returns:string filled with filler.


sequence

public static java.lang.String sequence(java.lang.Number number,
                                        int length)
Parameters:
number
length

Returns:sequence


getAutoNumber

public static java.lang.String getAutoNumber(java.lang.String sequence)
Get auto number from sequence.

 

Parameters:
sequence

 

Returns:String


prevSequence

public static java.lang.String prevSequence(java.lang.String lastSequence)
Parameters:
lastSequence

Returns:prevSequence


nextSequence

public static java.lang.String nextSequence(java.lang.String lastSequence,
                                            boolean isLoop)
Parameters:
lastSequence
isLoop

Returns:nextSequence0


nextSequence

public static java.lang.String nextSequence(java.lang.String lastSequence)
Same as :
 nextSequence(lastSequence, true);

 

Parameters:
lastSequence

 

Returns:nextSequence0


replaceFirst

public static java.lang.String replaceFirst(java.lang.String string,
                                            java.lang.String... replacements)
Replaces the first “[]” of this string with the given replacement.

 

Parameters:
string
replacements – – the string to be substituted for the first match

 

Returns:string


maxLength

public static java.lang.String maxLength(java.lang.String string,
                                         int maxLength,
                                         java.lang.String prefix_suffix)
Returns a new string with a specified maximum length.

 

Parameters:
string
maxLength
prefix_suffix

 

Returns:string


maxLength

public static java.lang.String maxLength(java.lang.String string,
                                         int maxLength)
Returns a new string with a specified maximum length.

 

Parameters:
string
maxLength

 

Returns:string


getBoolean

public static java.lang.Boolean getBoolean(java.lang.Object object)
Parameters:
object – an Object.

Returns:the Boolean value represented by the Object.


getByte

public static java.lang.Byte getByte(java.lang.Object object)
Parameters:
object – an Object.

Returns:a Byte object holding the value represented by the string
argument.


getDouble

public static java.lang.Double getDouble(java.lang.Object object)
Parameters:
object – an Object.

Returns:a Double object holding the value represented by the Object
argument.


getFloat

public static java.lang.Float getFloat(java.lang.Object object)
Parameters:
object – an Object.

Returns:a Float object holding the float value represented by the Object
argument.


getInteger

public static java.lang.Integer getInteger(java.lang.Object object)
Parameters:
object – an Object.

Returns:an Integer object holding the value represented by the Object
argument.


getLong

public static java.lang.Long getLong(java.lang.Object object)
Parameters:
object – an Object.

Returns:a Long object holding the value represented by the string
argument.


getShort

public static java.lang.Short getShort(java.lang.Object object)
Parameters:
object – an Object.

Returns:a Short object holding the value represented by the Object
argument.


parseByte

public static byte parseByte(java.lang.Object object)
Parameters:
object – an Object.

Returns:the byte value represented by the Object argument.


parseDouble

public static double parseDouble(java.lang.Object object)
Parameters:
object – an Object.

Returns:the double value represented by the Object argument.


parseFloat

public static float parseFloat(java.lang.Object object)
Parameters:
object – an Object.

Returns:the float value represented by the Object argument.


parseInt

public static int parseInt(java.lang.Object object)
Parameters:
object – an Object.

Returns:the integer value represented by the Object argument.


parseLong

public static long parseLong(java.lang.Object object)
Parameters:
object – an Object.

Returns:the long value represented by the Object argument.


parseShort

public static short parseShort(java.lang.Object object)
Parameters:
object – an Object.

Returns:the short value represented by the Object argument.


getString

public static java.lang.String getString(java.util.Date date,
                                         java.lang.String pattern)
Formats a Date into a date/time string.

 

Parameters:
date– the time value to be formatted into a time string.
pattern – the pattern describing the date and time format

 

Returns:the formatted time string.


getDate

public static java.util.Date getDate(java.lang.String string,
                                     java.lang.String pattern)
Parses text from the beginning of the given string to produce a date. The
method may not use the entire text of the given string.

 

Parameters:
string– A String whose beginning should be parsed.
pattern – the pattern describing the date and time format

 

Returns:A Date parsed from the string.


getCalendar

public static java.util.Calendar getCalendar(java.util.Date date)
Gets a calendar using the default time zone and locale. The Calendar
returned is based on the current time in the default time zone with the
default locale.

 

Parameters:
date – the given Date.

 

Returns:a Calendar.


getDate

public static int getDate(java.util.Date date)
Parameters:
date – the given Date.

Returns:date


getDayOfWeek

public static int getDayOfWeek(java.util.Date date)
Parameters:
date – the given Date.

Returns:day of week


getDayName

public static java.lang.String getDayName(int day)
Parameters:
day

Returns:1 = Sunday, 2 = Monday, … , 7 = Saturday


getWeekOfMonth

public static int getWeekOfMonth(java.util.Date date)
Parameters:
date – the given Date.

Returns:week of month


getWeekOfYear

public static int getWeekOfYear(java.util.Date date)
Parameters:
date – the given Date.

Returns:week of year


getMonth

public static int getMonth(java.util.Date date)
Parameters:
date – the given Date.

Returns:month


getMonthName

public static java.lang.String getMonthName(int month)
Parameters:
month

Returns:1 = January, 2 = February, … , 12 = December


getYear

public static int getYear(java.util.Date date)
Parameters:
date – the given Date.

Returns:year


getMinTime

public static java.util.Date getMinTime(java.util.Date date)
Parameters:
date – the given Date.

Returns:date with 00:00:00


getMaxTime

public static java.util.Date getMaxTime(java.util.Date date)
Parameters:
date – the given Date.

Returns:date with 23:59:59


getMinWeek

public static java.util.Date getMinWeek(java.util.Date date)
Parameters:
date – the given Date.

Returns:begin of week


getMaxWeek

public static java.util.Date getMaxWeek(java.util.Date date)
Parameters:
date – the given Date.

Returns:end of week


getMinDateTime

public static java.util.Date getMinDateTime(java.util.Date date)
Parameters:
date – the given Date.

Returns:date with first date and 00:00:00


getMaxDateTime

public static java.util.Date getMaxDateTime(java.util.Date date)
Parameters:
date – the given Date.

Returns:date with last date and 23:59:59


getMinMonthDateTime

public static java.util.Date getMinMonthDateTime(java.util.Date date)
Parameters:
date – the given Date.

Returns:date with first month and first date and 00:00:00


getMaxMonthDateTime

public static java.util.Date getMaxMonthDateTime(java.util.Date date)
Parameters:
date – the given Date.

Returns:date with last month and last date and 23:59:59


getAlteredMinute

public static java.util.Date getAlteredMinute(java.util.Date currentDate,
                                              int minute)
Parameters:
currentDate– the given Date.
minute

Returns:Date


getPrevMinute

public static java.util.Date getPrevMinute(java.util.Date date)
Parameters:
date – the given Date.

Returns:Date


getNextMinute

public static java.util.Date getNextMinute(java.util.Date date)
Parameters:
date – the given Date.

Returns:Date


getNextMinute

public static java.util.Date getNextMinute(java.util.Date date,
                                           int value)
Parameters:
date– the given Date.
value

Returns:Date


getAlteredHour

public static java.util.Date getAlteredHour(java.util.Date currentDate,
                                            int hour)
Parameters:
currentDate– the given Date.
hour

Returns:Date


getPrevHour

public static java.util.Date getPrevHour(java.util.Date date)
Parameters:
date – the given Date.

Returns:Date


getNextHour

public static java.util.Date getNextHour(java.util.Date date)
Parameters:
date – the given Date.

Returns:Date


getNextHour

public static java.util.Date getNextHour(java.util.Date date,
                                         int value)
Parameters:
date– the given Date.
value

Returns:Date


getAlteredDate

public static java.util.Date getAlteredDate(java.util.Date currentDate,
                                            int date)
Parameters:
currentDate– the given Date.
date

Returns:Date


getPrevDate

public static java.util.Date getPrevDate(java.util.Date date)
Parameters:
date – the given Date.

Returns:Date


getNextDate

public static java.util.Date getNextDate(java.util.Date date)
Parameters:
date – the given Date.

Returns:Date


getNextDate

public static java.util.Date getNextDate(java.util.Date date,
                                         int value)
Parameters:
date– the given Date.
value

Returns:Date


getAlteredMonth

public static java.util.Date getAlteredMonth(java.util.Date currentDate,
                                             int month)
Parameters:
currentDate– the given Date.
month

Returns:Date


getPrevMonth

public static java.util.Date getPrevMonth(java.util.Date date)
Parameters:
date – the given Date.

Returns:Date


getNextMonth

public static java.util.Date getNextMonth(java.util.Date date)
Parameters:
date – the given Date.

Returns:Date


getNextMonth

public static java.util.Date getNextMonth(java.util.Date date,
                                          int value)
Parameters:
date– the given Date.
value

Returns:Date


getAlteredYear

public static java.util.Date getAlteredYear(java.util.Date currentDate,
                                            int year)
Parameters:
currentDate– the given Date.
year

Returns:Date


getPrevYear

public static java.util.Date getPrevYear(java.util.Date date)
Parameters:
date – the given Date.

Returns:Date


getNextYear

public static java.util.Date getNextYear(java.util.Date date)
Parameters:
date – the given Date.

Returns:Date


getNextYear

public static java.util.Date getNextYear(java.util.Date date,
                                         int value)
Parameters:
date– the given Date.
value

Returns:Date


getDiffMilliseconds

public static long getDiffMilliseconds(java.util.Date date1,
                                       java.util.Date date2)
Parameters:
date1– the given Date.
date2 – the given Date.

Returns:date2.getTime() – date1.getTime()


getDiffSeconds

public static double getDiffSeconds(java.util.Date date1,
                                    java.util.Date date2)
Parameters:
date1– the given Date.
date2 – the given Date.

Returns:getDiffMilliseconds(date1, date2) / 1000


getDiffMinutes

public static double getDiffMinutes(java.util.Date date1,
                                    java.util.Date date2)
Parameters:
date1– the given Date.
date2 – the given Date.

Returns:getDiffSeconds(date1, date2) / 60


getDiffHours

public static double getDiffHours(java.util.Date date1,
                                  java.util.Date date2)
Parameters:
date1– the given Date.
date2 – the given Date.

Returns:getDiffMinutes(date1, date2) / 60


getDiffDays

public static double getDiffDays(java.util.Date date1,
                                 java.util.Date date2)
Parameters:
date1– the given Date.
date2 – the given Date.

Returns:getDiffHours(date1, date2) / 24


getDiffMonths

public static double getDiffMonths(java.util.Date date1,
                                   java.util.Date date2)
Parameters:
date1– the given Date.
date2 – the given Date.

Returns:getDiffDays(date1, date2) / 30


getDiffYears

public static double getDiffYears(java.util.Date date1,
                                  java.util.Date date2)
Parameters:
date1– the given Date.
date2 – the given Date.

Returns:getDiffMonths(date1, date2) / 12


getDiffString

public static java.lang.String getDiffString(java.util.Date date1,
                                             java.util.Date date2,
                                             java.lang.String format)
Parameters:
date1– the given Date.
date2– the given Date.
format – y|M|d|H|m|s|S

Returns:String


getTime

public static java.sql.Time getTime(java.util.Date date,
                                    boolean... options)
Parameters:
date– the given Date.
options

  • [0]: noSecond (default: false)
Returns:
A Time parsed from the date.

getTime

public static java.sql.Time getTime(java.lang.String string,
                                    java.lang.String pattern)
Parameters:
string– A String whose beginning should be parsed.
pattern – the pattern describing the date and time format

Returns:A Time parsed from the string.


getZeroTime

public static java.sql.Time getZeroTime()
Returns:
00:00:00

copyTime

public static java.util.Date copyTime(java.util.Date date,
                                      java.sql.Time time)
Copy value from Time to “Time fields” of Date.

 

Parameters:
date– the given Date.
time

 

Returns:date with time


fillTime

public static java.util.Date fillTime(java.util.Date date)
Same as :
 copyTime(date, getTime(new Date()));

 

Parameters:
date – the given Date.

 

Returns:date with time


getTimestamp

public static java.sql.Timestamp getTimestamp(java.util.Date date)
Parameters:
date – the given Date.

Returns:timestamp represented by this date.


getTimestamp

public static java.sql.Timestamp getTimestamp(java.lang.String string,
                                              java.lang.String pattern)
Parameters:
string– A String whose beginning should be parsed.
pattern – the pattern describing the date and time format

Returns:timestamp represented by this string and pattern.


terbilang

public static java.lang.String terbilang(java.lang.Double digit)
Parameters:
digit

Returns:String


bill

public static java.util.HashMap<java.lang.Integer,java.lang.Integer> bill(double money)
Parameters:
money

Returns:HashMap


getRandom8

public static java.lang.String getRandom8()
Returns:
a random String which has length 8.

getFormatNumber

public static java.lang.String getFormatNumber()
Returns:
formatNumber #,##0

getColorHex

public static java.lang.String getColorHex(java.awt.Color color)
Parameters:
color

Returns:hex a String that represents an opaque color as a 24-bit integer


getColor

public static java.awt.Color getColor(java.lang.String hex)
Converts a String to an integer and returns the specified opaque Color.

 

Parameters:
hex – a String that represents an opaque color as a 24-bit integer

 

Returns:the new Color object.

  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: