Formater.java
22.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
package com.sitech.util;
import java.io.BufferedReader;
import java.io.DataInputStream;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.sql.Timestamp;
import java.text.NumberFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.StringTokenizer;
import java.util.Vector;
import org.nfunk.jep.JEP;
public class Formater {
public final static String INVALIDDATE = "1950-01-01";
private final static String SQLTYPE = "SYBASE";
public final static String getNowTime() {
SimpleDateFormat formatter1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
return formatter1.format(new Date());
}
public final static String getToday() {
SimpleDateFormat formatter1 = new SimpleDateFormat("yyyy-MM-dd");
return formatter1.format(new Date());
}
public final static String getDateAsFile(Date dDate) throws ParseException {
SimpleDateFormat formatter1 = new SimpleDateFormat("MMddHHmmss");
return formatter1.format(dDate);
}
public final static String getSybaseFormatDate(String cDate) {
return cDate;
}
public final static String getSybaseFormatDate(Date dDate) throws ParseException {
SimpleDateFormat formatter1 = new SimpleDateFormat("yyyy-MM-dd");
return formatter1.format(dDate);
}
public final static String getSybaseFormatDateTime(Date dDate) {
SimpleDateFormat formatter1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
return formatter1.format(dDate);
}
public final static String dateToString(Date dDate){
if (null == dDate) {
return "";
}
SimpleDateFormat formatter1 = new SimpleDateFormat("yyyy-MM-dd");
if (formatter1.format(dDate).equals(INVALIDDATE)) {
return "";
}
return formatter1.format(dDate);
}
public final static String datetimeToString(Date date){
if (null == date) {
return "";
}
if (dateToString(date).equals("")) {
return "";
}
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
return formatter.format(date);
}
public final static String datetimeToString(Date date, String formate) {
try{
if (null == date) {
return "";
}
SimpleDateFormat formatter = new SimpleDateFormat(formate);
return formatter.format(date);
}catch (Exception e) {
return "";
}
}
public static String counter64_sub(String newCounter, String oldCounter) {
String result = "0";
String counterType = "64";
if(newCounter==null||newCounter.equals("")||newCounter.equals("--"))
return "";
if(oldCounter==null||oldCounter.equals("")||oldCounter.equals("--"))
return "";
result = counter_sub(newCounter, oldCounter, counterType);
return result;
}
/**
*
* @param newCounter
* @param oldCounter
* @param counterType
* 32:32λ;64:64λ
* @return
*/
public static String counter_sub(String newCounter, String oldCounter,
String counterType) {
// 2^32 = 4294967295
// 2^64 = 18446744073709551615
String result = "0";
try {
BigInteger newbi = new BigInteger(newCounter);
BigInteger oldbi = new BigInteger(oldCounter);
BigInteger bi3 = new BigInteger("-1");
if (newbi.compareTo(oldbi) >= 0) {
// newbi >= oldbi
result = newbi.add(oldbi.divide(bi3)).toString();
} else {
BigInteger bi4 = null;
if (counterType.equals("32")) {
bi4 = new BigInteger("4294967295");
} else if (counterType.equals("64")) {
bi4 = new BigInteger("18446744073709551615");
}
result = bi4.add(oldbi.divide(bi3)).add(newbi).toString();
}
} catch (Exception e) {
e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
}
return result;
}
public static String double2String(double d) {
int max_fraction_digits = 2;
int min_fraction_digits = 2;
return double2String(d, max_fraction_digits, min_fraction_digits);
}
public final static String fromDBTimeStamp(Timestamp ts, String format) {
SimpleDateFormat sdf = new SimpleDateFormat(format);
return sdf.format(fromDBTimeStamp(ts));
}
public final static int string2int(String chs) {
int result=0;
try {
if(chs==null||chs.equals(""))
return result;
else
{
result= (new Integer(chs)).intValue();
}
} catch (NumberFormatException e) {
e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
}
return result;
}
public final static Date fromDBTimeStamp(Timestamp ts) {
Date result = new Date(ts.getTime());
return result;
}
/**
*
* @param newCounter
* @param oldCounter
* @return
*/
public static String counter32_sub(String newCounter, String oldCounter) {
String result = "0";
String counterType = "32";
if (newCounter == null || newCounter.equals("") || newCounter.equals("--"))
return "";
if (oldCounter == null || oldCounter.equals("") || oldCounter.equals("--"))
return "";
result = counter_sub(newCounter, oldCounter, counterType);
return result;
}
/**
* @return
*/
public static String double2String(double d, int max_fraction_digits,
int min_fraction_digits) {
String result = "";
try {
NumberFormat nf = NumberFormat.getInstance();
nf.setMaximumFractionDigits(max_fraction_digits);
nf.setMinimumFractionDigits(min_fraction_digits);
result = nf.format(d);
if(result.indexOf(",")!=-1)
result= result.replaceAll(",","");
} catch (Exception e) {
e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
}
return result;
}
/**
* @return
*/
public static double parseExpression(String expression) {
double result = 0;
try {
JEP jep = new JEP();
jep.parseExpression(expression);
result = jep.getValue();
} catch (Exception e) {
e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
}
return result;
}
/* modified by wangxj on 2002/08/02 */
public final static String dateOnWeb(Date dDate) throws ParseException {
if (null == dDate) {
return "";
}
String cDate = dateToString(dDate);
if (cDate.equals("")) {
return "";
}
SimpleDateFormat formatter1 = new SimpleDateFormat("yy-MM-dd HH:mm");
return formatter1.format(dDate);
}
/* modified by xielj on 2002/08/11 */
public final static String timeOnWeb(Date dDate) throws ParseException {
if (null == dDate) {
return "";
}
String cDate = datetimeToString(dDate);
if (cDate.equals("")) {
return "";
}
SimpleDateFormat formatter1 = new SimpleDateFormat("HH:mm");
return formatter1.format(dDate);
}
public final static String timeOnWeb(String cDate) throws ParseException {
if (cDate.equals("")) {
return "";
}
SimpleDateFormat formatter1 = new SimpleDateFormat("HH:mm");
java.util.Date dDate = stringToDateTime(cDate);
return formatter1.format(dDate);
}
public final static Date stringToDate(String cDate, String cFormat) throws ParseException {
SimpleDateFormat formatter1 = new SimpleDateFormat(cFormat);
return formatter1.parse(cDate);
}
public final static Date stringToDate(String cDate) throws ParseException {
try {
SimpleDateFormat formatter1 = new SimpleDateFormat("yyyy-MM-dd");
return formatter1.parse(cDate);
} catch (ParseException e) {
try {
SimpleDateFormat formatter1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
return formatter1.parse(cDate);
} catch (ParseException ee) {
SimpleDateFormat formatter1 = new SimpleDateFormat("yyyyMMdd HH:mm:ss");
return formatter1.parse(cDate);
}
}
}
public final static Date stringToDateTime(String cDate) throws ParseException {
try {
SimpleDateFormat formatter1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
return formatter1.parse(cDate);
} catch (ParseException e) {
try {
SimpleDateFormat formatter1 = new SimpleDateFormat("yyyyMMdd HH:mm:ss");
return formatter1.parse(cDate);
} catch (ParseException ee) {
SimpleDateFormat formatter1 = new SimpleDateFormat("yyyy-MM-dd");
return formatter1.parse(cDate);
}
}
}
public final static String toHTMLString(String chs) {
if (chs.equals("")) {
return chs;
} else {
StringTokenizer st = new StringTokenizer(chs, "\n");
String rt = new String("");
String cHTMLEnter = "<br>";
while (st.hasMoreTokens()) {
rt = rt + st.nextToken() + cHTMLEnter;
}
int i = 0;
while (true) {
if (rt.charAt(i) == 32) {
i++;
} else
break;
}
if (i > 0) {
String cSpace = "";
for (int j = 0; j < i; j++) {
cSpace = cSpace + " ";
}
rt = cSpace + rt.substring(i);
}
return rt;
}
}
public final static String ltrimtoHTMLString(String chs) {
StringTokenizer st = new StringTokenizer(chs, "\n");
String rt = new String("");
String cHTMLEnter = "<br>";
while (st.hasMoreTokens()) {
rt = rt + st.nextToken() + cHTMLEnter;
}
return rt;
}
/*
* public final static String toHTMLURL(String chs){ return
* java.net.URLEncoder.encode(chs); }
*/
/**
*/
public static String toHTMLBracket(String s) {
StringBuffer str = new StringBuffer();
int len = (s != null) ? s.length() : 0;
for (int i = 0; i < len; i++) {
char ch = s.charAt(i);
switch (ch) {
case '<': {
str.append("<");
break;
}
case '>': {
str.append(">");
break;
}
default: {
str.append(ch);
}
}
}
return str.toString();
}
public final static String fromSybaseString(String chs) throws java.io.UnsupportedEncodingException {
if (null == chs)
return "";
// String temp = new String(chs.getBytes("ISO8859_1"),"GBK");
return chs;
}
public final static String fromDBString(String chs) throws java.io.UnsupportedEncodingException {
if (null == chs)
return "";
String temp = chs;// new String(chs.getBytes("ISO8859_1"),"GBK");
return temp;
}
public final static String toSybaseString(String chs) throws java.io.UnsupportedEncodingException {
if (null == chs)
return "";
// String temp = new String(chs.getBytes("GBK"),"ISO8859_1");
return chs;
}
public final static String toDBString(String chs) throws java.io.UnsupportedEncodingException {
if (null == chs)
return "";
String temp = chs;// new String(chs.getBytes("GBK"),"ISO8859_1");
return temp;
}
// public final static String toOSString(String chs)
// throws java.io.UnsupportedEncodingException {
// if (chs == null)
// return "";
// String temp = new String(chs.getBytes("GBK"), OSCHARSET);
// return temp;
// }
public final static String toOracleDate(Date dDate) throws ParseException {
SimpleDateFormat formatter1 = new SimpleDateFormat("yyyy-MM-dd");
return " to_date('" + formatter1.format(dDate) + "','yyyy-MM-dd') ";
}
public final static String toOracleDateTime(Date dDate) throws ParseException {
SimpleDateFormat formatter1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
return " to_date('" + formatter1.format(dDate) + "','yyyy-MM-dd HH24:mi:ss') ";
}
private final static String toSybaseDate(Date dDate) throws ParseException {
SimpleDateFormat formatter1 = new SimpleDateFormat("yyyy-MM-dd");
return " '" + formatter1.format(dDate) + "' ";
}
private final static String toSybaseDateTime(Date dDate) throws ParseException {
SimpleDateFormat formatter1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
return " '" + formatter1.format(dDate) + "' ";
}
public final static String toDBDate(Date dDate) throws ParseException {
if (null == dDate) {
dDate = stringToDate(INVALIDDATE);
}
String cSQLDate = null;
if (SQLTYPE.equals("ORACLE"))
cSQLDate = toOracleDate(dDate);
if (SQLTYPE.equals("SYBASE"))
cSQLDate = toSybaseDate(dDate);
return cSQLDate;
}
public final static String toDBDate(String cDate) throws ParseException {
if (null == cDate) {
cDate = INVALIDDATE;
}
return toDBDate(stringToDate(cDate));
}
public final static String toDBDateTime(Date dDate) throws ParseException {
if (null == dDate) {
dDate = stringToDate(INVALIDDATE);
}
String cSQLDate = null;
if (SQLTYPE.equals("ORACLE"))
cSQLDate = toOracleDateTime(dDate);
if (SQLTYPE.equals("SYBASE"))
cSQLDate = toSybaseDateTime(dDate);
return cSQLDate;
}
public final static String toDBDateTime(String cDate) throws ParseException {
if (null == cDate) {
cDate = INVALIDDATE;
}
return toDBDateTime(stringToDateTime(cDate));
}
public final static String getFormattedCLL_TIME(String CLL_TIME) {
String cllTime = "";
SimpleDateFormat formatter1 = null;
SimpleDateFormat formatter2 = new SimpleDateFormat("MM-dd HH:mm");
java.util.Date dCLL_TIME = null;
try {
formatter1 = new SimpleDateFormat("yyyyMMdd HH:mm:ss");
dCLL_TIME = formatter1.parse(CLL_TIME);
} catch (ParseException e) {
try {
formatter1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
dCLL_TIME = formatter1.parse(CLL_TIME);
} catch (ParseException e1) {
// Loger.errLog(e);
}
}
if (dCLL_TIME != null)
cllTime = formatter2.format(dCLL_TIME);
return cllTime;
}
public static ArrayList split(String str, String sp) {
int ip = 0;
ArrayList al = new ArrayList();
ip = str.indexOf(sp);
if (ip != -1) {
al.add(str.substring(0, ip));
str = str.substring(ip + sp.length());
if (str.length() != 0) {
al.addAll(split(str, sp));
}
} else {
al.add(str);
}
return al;
}
public static String neatenunitid(String str) {
ArrayList al = split(str, "-");
Object[] os = al.toArray();
String ss = "";
for (int i = 0; i < os.length; i++) {
ss = ss + (String) os[i] + "_";
}
ss = ss.substring(0, ss.length() - 1);
ss = ss.replaceAll("\\.", "_");
ss = replaceSpace(ss);
return ss;
}
public static String replaceSpace(String str) {
ArrayList al = split(str, " ");
Object[] os = al.toArray();
String ss = "";
for (int i = 0; i < os.length; i++) {
ss = ss + (String) os[i];
}
return ss;
}
public final static String toStr(String strSy) throws java.io.UnsupportedEncodingException {
if (null == strSy)
return "";
String strDB = new String(strSy.getBytes("ISO8859_1"), "GB2312");
return strDB;
}
public final static String toBackStr(String strSy) throws java.io.UnsupportedEncodingException {
if (null == strSy)
return "";
String strDB = new String(strSy.getBytes("GB2312"), "ISO8859_1");
return strDB;
}
/**
* (1) parameter description
*
* @param date
* @param type
* @param timeInterval
* @return (2)function description realize the time plus and minus (3) loop
* condition y: year m: month d: date h:hour f: minute(fenzhong) s:
* second
*/
public static Date computeDate(Date date, char type, int timeInterval) {
Calendar cal = Calendar.getInstance();
cal.setTime(date);
int Time_year = cal.get(Calendar.YEAR);
int Time_month = cal.get(Calendar.MONTH);
int Time_day = cal.get(Calendar.DAY_OF_MONTH);
int Time_hour = cal.get(Calendar.HOUR_OF_DAY);
int Time_minute = cal.get(Calendar.MINUTE);
int Time_second = cal.get(Calendar.SECOND);
switch (type) {
case 'y': {
Time_year = Time_year + timeInterval;
cal.set(Calendar.YEAR, Time_year);
}
break;
case 'm': {
Time_month = Time_month + timeInterval;
cal.set(Calendar.MONTH, Time_month);
}
break;
case 'd': {
Time_day = Time_day + timeInterval;
cal.set(Calendar.DAY_OF_MONTH, Time_day);
}
break;
case 'h': {
Time_hour = Time_hour + timeInterval;
cal.set(Calendar.HOUR_OF_DAY, Time_hour);
}
break;
case 'f': {
Time_minute = Time_minute + timeInterval;
cal.set(Calendar.MINUTE, Time_minute);
}
break;
case 's': {
Time_second = Time_second + timeInterval;
cal.set(Calendar.SECOND, Time_second);
}
break;
default:
break;
}
// date = cal.getTime();
return cal.getTime();
}
static public boolean iffileinuse(String filestr) {
boolean result = false;
Vector resultvec = execute("fuser " + filestr);
if (resultvec == null) {
return false;
}
String RSstr = null;
try {
RSstr = (String) resultvec.elementAt(0);
} catch (RuntimeException e) {
//
e.printStackTrace();
}
String[] RSStrsp = RSstr.split(":");
String rsstr2 = RSStrsp[1];
if (rsstr2 != null && !"".equals(rsstr2.trim())) {
result = false;
} else {
result = true;
}
return result;
}
static public Vector execute(String shellCommand) {
try {
Runtime sys = Runtime.getRuntime();
Process process = sys.exec(shellCommand);
Vector vResult = new Vector();
DataInputStream in = new DataInputStream(process.getInputStream());
BufferedReader reader = new BufferedReader(new InputStreamReader(in));
String line;
do {
line = reader.readLine();
if (line == null) {
break;
} else {
vResult.addElement(line);
}
} while (true);
reader.close();
process.destroy();
return vResult;
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
/**
*/
static public String getByScale(String double_value, int scale) {
java.math.BigDecimal x = null;
try {
x = new java.math.BigDecimal(double_value);
x = x.setScale(scale, java.math.BigDecimal.ROUND_HALF_UP);
} catch (Exception e) {
e.printStackTrace();
return double_value;
}
return x.toString();
}
static public String formatDecimalByScale(String doubleValue, int scale) {
if (doubleValue.indexOf('.') < 0) {
return doubleValue;
}
java.math.BigDecimal x = null;
try {
x = new java.math.BigDecimal(doubleValue);
x = x.setScale(scale, java.math.BigDecimal.ROUND_HALF_UP);
} catch (Exception e) {
e.printStackTrace();
return doubleValue;
}
String result = x.toString();
while(result.endsWith("0")){
result = result.substring(0, result.length() - 1);
}
if(result.endsWith(".")){
result = result.substring(0, result.length() - 1);
}
//
// if (result.lastIndexOf("0000") == (result.length() - 4)) {
// result = result.substring(0, result.length() - 5);
// }
return result;
}
/**
*/
public static String formatDecimalKpivalue(String decimalValue) {
if (decimalValue.indexOf('.') < 0) {
return decimalValue;
} else {
int scale = 3;
String scale_value = Formater.getByScale(decimalValue, scale);
if (scale_value.lastIndexOf("00") == (scale_value.length() - 2)) {
scale_value = scale_value
.substring(0, scale_value.length() - 4);
}
return scale_value;
}
}
public static String[] split2Array(String str, String split) {
return str.split(split);
}
public static String dev2IntIntoFloat(String instr1, String instr2, int scale) {
if (instr2.trim().equals("0.0")) {
return "0";
} else {
float res = Float.parseFloat(instr1) / Float.parseFloat(instr2) * 100;
return formatDecimalByScale(res + "", scale);
}
}
public static String realyRate(String instr) {
if (Math.abs(Float.valueOf(instr)) > 100.0) {
if (Float.valueOf(instr) > 0) {
instr = "100.00";
} else {
instr = "-100.00";
}
}
return instr;
}
public static String devDayHourSecond(Long longtime) {
String res = "";
int day = Integer.parseInt(String.valueOf(longtime / 86400000));
int hour = Integer.parseInt(String.valueOf((longtime - day * 86400000) / 3600000));
int minute = Integer.parseInt(String.valueOf((longtime - day * 86400000 - hour * 3600000) / 60000));
int second = Integer.parseInt(String.valueOf((longtime - day * 86400000 - hour * 3600000 - minute * 60000) / 1000));
if (day > 0) {
res += day + "days";
}
if (hour > 0) {
res += " " + hour + "hours";
}
if (minute > 0) {
res += " " + minute + "minutes";
}
return res.trim();
}
public static String convertKBMB2GB(String data, String measure) {
String res = "";
if ("KB".endsWith(measure) || "K".endsWith(measure)) {
res = Formater.formatDecimalByScale(String.valueOf(Float.valueOf(data) / 1024.0 / 1024.0), 2);
} else if ("MB".endsWith(measure) || "M".endsWith(measure)) {
res = Formater.formatDecimalByScale(String.valueOf(Float.valueOf(data) / 1024.0), 2);
} else {
res = data;
}
return res.trim() + "G";
}
public static String hexToInt(String ipaddr) {
String res = "";
String[] ips = ipaddr.split(":");
for (String _ips : ips) {
res = res + Integer.parseInt(_ips.toUpperCase(),16) + ".";
}
return res.substring(0, res.length() - 1);
}
public static void main(String[] args) {
/*System.out.println(Math.abs(Float.valueOf("100")));
System.out.println(Math.abs(Float.valueOf("99.24")));
System.out.println(Math.abs(Float.valueOf("199.24")));
System.out.println(Math.abs(Float.valueOf("-199.24")));
System.out.println(Math.abs(Float.valueOf("-99.24")));
System.out.println(Math.abs(Float.valueOf("-0.24")));
System.out.println(Math.abs(Float.valueOf("1002")));
System.out.println(Math.abs(Float.valueOf("-1002.32")));
System.out.println();
System.out.println(Formater.realyRate("100"));
System.out.println(Formater.realyRate("99.24"));
System.out.println(Formater.realyRate("199.24"));
System.out.println(Formater.realyRate("-199.24"));
System.out.println(Formater.realyRate("-99.24"));
System.out.println(Formater.realyRate("-0.24"));
System.out.println(Formater.realyRate("1002"));
System.out.println(Formater.realyRate("-1002.32"));*/
System.out.println(Formater.formatDecimalKpivalue("2.3234"));
System.out.println(Formater.formatDecimalKpivalue("2.3235"));
System.out.println(Formater.formatDecimalKpivalue("0.3235"));
System.out.println(Formater.formatDecimalKpivalue("0.00005"));
System.out.println(Formater.formatDecimalKpivalue("1.00005"));
System.out.println(Formater.formatDecimalKpivalue("10.00005"));
System.out.println(Formater.hexToInt("0a:91:c3:02"));
}
}