Subversion Repository Public Repository

litesoft

Diff Revisions 808 vs 809 for /trunk/Java/core/Anywhere/src/org/litesoft/core/typeutils/Integers.java

Diff revisions: vs.
  @@ -42,4 +42,69 @@
42 42 throw new IllegalArgumentException( pObjectName + ": Expected '" + pExpected + "', but was '" + pActual + "'" );
43 43 }
44 44 }
45 +
46 + public static String zeroPadIt( int pMinDesiredLength, int pIt )
47 + {
48 + String rv = String.valueOf( pIt );
49 + while ( rv.length() < pMinDesiredLength )
50 + {
51 + rv = "0" + rv;
52 + }
53 + return rv;
54 + }
55 +
56 + public static String padIt( int pMinDesiredLength, int pIt )
57 + {
58 + return Strings.padIt( pMinDesiredLength, "" + pIt );
59 + }
60 +
61 + public static String iTpad( int pIt, int pMinDesiredLength )
62 + {
63 + return Strings.iTpad( "" + pIt, pMinDesiredLength );
64 + }
65 +
66 + public static boolean isNullOrEmpty( int[] pArrayToCheck )
67 + {
68 + return (pArrayToCheck == null || pArrayToCheck.length == 0);
69 + }
70 +
71 + public static boolean areArraysEqual( byte[] pThis, byte[] pThat )
72 + {
73 + if ( pThis == pThat ) // handles if both are null
74 + {
75 + return true;
76 + }
77 + if ( (pThis != null) && (pThat != null) && (pThis.length == pThat.length) )
78 + {
79 + for ( int i = pThis.length; --i >= 0; )
80 + {
81 + if ( pThis[i] != pThat[i] )
82 + {
83 + return false;
84 + }
85 + }
86 + return true;
87 + }
88 + return false;
89 + }
90 +
91 + public static boolean areArraysEqual( int[] pThis, int[] pThat )
92 + {
93 + if ( pThis == pThat ) // handles if both are null
94 + {
95 + return true;
96 + }
97 + if ( (pThis != null) && (pThat != null) && (pThis.length == pThat.length) )
98 + {
99 + for ( int i = pThis.length; --i >= 0; )
100 + {
101 + if ( pThis[i] != pThat[i] )
102 + {
103 + return false;
104 + }
105 + }
106 + return true;
107 + }
108 + return false;
109 + }
45 110 }