Some code formatting.

This commit is contained in:
MobiusDev
2016-03-19 08:47:52 +00:00
parent 9a9a5dd414
commit 345b88ad95
106 changed files with 308 additions and 308 deletions

View File

@@ -51,7 +51,7 @@ public class HexUtils
* @param data byte to generate the hexadecimal character presentation from
* @return a new char array with exactly 2 elements
*/
public static char[] b2HexChars(final byte data)
public static char[] b2HexChars(byte data)
{
return b2HexChars(data, null, 0);
}
@@ -63,7 +63,7 @@ public class HexUtils
* @param dstOffset offset at which the hexadecimal character presentation is copied to dstHexChars
* @return the char array the hexadecimal character presentation was copied to
*/
public static char[] b2HexChars(final byte data, char[] dstHexChars, int dstOffset)
public static char[] b2HexChars(byte data, char[] dstHexChars, int dstOffset)
{
if (dstHexChars == null)
{
@@ -84,7 +84,7 @@ public class HexUtils
* @param data integer to generate the hexadecimal character presentation from
* @return new char array with 8 elements
*/
public static char[] int2HexChars(final int data)
public static char[] int2HexChars(int data)
{
return int2HexChars(data, new char[8], 0);
}
@@ -96,7 +96,7 @@ public class HexUtils
* @param dstOffset offset at which the hexadecimal character presentation is copied to dstHexChars
* @return the char array the hexadecimal character presentation was copied to
*/
public static char[] int2HexChars(final int data, char[] dstHexChars, int dstOffset)
public static char[] int2HexChars(int data, char[] dstHexChars, int dstOffset)
{
if (dstHexChars == null)
{
@@ -119,7 +119,7 @@ public class HexUtils
* @param len number of bytes to generate the hexadecimal character presentation from
* @return a new char array with len*2 elements
*/
public static char[] bArr2HexChars(final byte[] data, final int offset, final int len)
public static char[] bArr2HexChars(byte[] data, int offset, int len)
{
return bArr2HexChars(data, offset, len, null, 0);
}
@@ -133,7 +133,7 @@ public class HexUtils
* @param dstOffset offset at which the hexadecimal character presentation is copied to dstHexChars
* @return the char array the hexadecimal character presentation was copied to
*/
public static char[] bArr2HexChars(final byte[] data, final int offset, final int len, char[] dstHexChars, int dstOffset)
public static char[] bArr2HexChars(byte[] data, int offset, int len, char[] dstHexChars, int dstOffset)
{
if (dstHexChars == null)
{
@@ -152,12 +152,12 @@ public class HexUtils
return dstHexChars;
}
public static char[] bArr2AsciiChars(byte[] data, final int offset, final int len)
public static char[] bArr2AsciiChars(byte[] data, int offset, int len)
{
return bArr2AsciiChars(data, offset, len, new char[len], 0);
}
public static char[] bArr2AsciiChars(byte[] data, final int offset, final int len, char[] dstAsciiChars, int dstOffset)
public static char[] bArr2AsciiChars(byte[] data, int offset, int len, char[] dstAsciiChars, int dstOffset)
{
if (dstAsciiChars == null)
{

View File

@@ -40,19 +40,19 @@ public final class Rnd
this(++SEED_UNIQUIFIER + System.nanoTime());
}
public NonAtomicRandom(final long seed)
public NonAtomicRandom(long seed)
{
setSeed(seed);
}
@Override
public final int next(final int bits)
public final int next(int bits)
{
return (int) ((_seed = ((_seed * MULTIPLIER) + ADDEND) & MASK) >>> (48 - bits));
}
@Override
public final void setSeed(final long seed)
public final void setSeed(long seed)
{
_seed = (seed ^ MULTIPLIER) & MASK;
}
@@ -65,7 +65,7 @@ public final class Rnd
{
private final Random _random;
protected RandomContainer(final Random random)
protected RandomContainer(Random random)
{
_random = random;
}
@@ -90,7 +90,7 @@ public final class Rnd
* @param n The superior limit (exclusive)
* @return A random integer number from 0 to n-1
*/
public final int get(final int n)
public final int get(int n)
{
return (int) (_random.nextDouble() * n);
}
@@ -101,7 +101,7 @@ public final class Rnd
* @param max The maximum value
* @return A random integer number from min to max
*/
public final int get(final int min, final int max)
public final int get(int min, int max)
{
return min + (int) (_random.nextDouble() * ((max - min) + 1));
}
@@ -112,7 +112,7 @@ public final class Rnd
* @param max The maximum value
* @return A random long number from min to max
*/
public final long get(final long min, final long max)
public final long get(long min, long max)
{
return min + (long) (_random.nextDouble() * ((max - min) + 1));
}
@@ -132,7 +132,7 @@ public final class Rnd
* @param array The array to be filled with random byte numbers
* @see java.util.Random#nextBytes(byte[] bytes)
*/
public final void nextBytes(final byte[] array)
public final void nextBytes(byte[] array)
{
_random.nextBytes(array);
}
@@ -235,17 +235,17 @@ public final class Rnd
{
long _seed;
Seed(final long seed)
Seed(long seed)
{
setSeed(seed);
}
final int next(final int bits)
final int next(int bits)
{
return (int) ((_seed = ((_seed * MULTIPLIER) + ADDEND) & MASK) >>> (48 - bits));
}
final void setSeed(final long seed)
final void setSeed(long seed)
{
_seed = (seed ^ MULTIPLIER) & MASK;
}
@@ -265,7 +265,7 @@ public final class Rnd
};
}
public ThreadLocalRandom(final long seed)
public ThreadLocalRandom(long seed)
{
_seedLocal = new ThreadLocal<Seed>()
{
@@ -278,13 +278,13 @@ public final class Rnd
}
@Override
public final int next(final int bits)
public final int next(int bits)
{
return _seedLocal.get().next(bits);
}
@Override
public final void setSeed(final long seed)
public final void setSeed(long seed)
{
if (_seedLocal != null)
{
@@ -323,7 +323,7 @@ public final class Rnd
* @param n The superior limit (exclusive)
* @return A random integer number from 0 to n-1
*/
public static final int get(final int n)
public static final int get(int n)
{
return rnd.get(n);
}
@@ -334,7 +334,7 @@ public final class Rnd
* @param max The maximum value
* @return A random integer number from min to max
*/
public static final int get(final int min, final int max)
public static final int get(int min, int max)
{
return rnd.get(min, max);
}
@@ -345,12 +345,12 @@ public final class Rnd
* @param max The maximum value
* @return A random long number from min to max
*/
public static final long get(final long min, final long max)
public static final long get(long min, long max)
{
return rnd.get(min, max);
}
public static final RandomContainer newInstance(final RandomType type)
public static final RandomContainer newInstance(RandomType type)
{
switch (type)
{
@@ -390,7 +390,7 @@ public final class Rnd
* @param array The array to be filled with random byte numbers
* @see java.util.Random#nextBytes(byte[] bytes)
*/
public static final void nextBytes(final byte[] array)
public static final void nextBytes(byte[] array)
{
rnd.nextBytes(array);
}
@@ -440,7 +440,7 @@ public final class Rnd
* @return
* @see com.l2jmobius.util.Rnd#get(int n)
*/
public static final int nextInt(final int n)
public static final int nextInt(int n)
{
return get(n);
}

View File

@@ -197,7 +197,7 @@ public final class StringUtil
* @param strings strings to be concatenated
* @return concatenated string
*/
public static String concat(final String... strings)
public static String concat(String... strings)
{
final StringBuilder sbString = new StringBuilder();
for (String string : strings)
@@ -213,7 +213,7 @@ public final class StringUtil
* @param strings strings to be appended
* @return created string builder
*/
public static StringBuilder startAppend(final int sizeHint, final String... strings)
public static StringBuilder startAppend(int sizeHint, String... strings)
{
final int length = getLength(strings);
final StringBuilder sbString = new StringBuilder(sizeHint > length ? sizeHint : length);
@@ -229,7 +229,7 @@ public final class StringUtil
* @param sbString string builder
* @param strings strings to be appended
*/
public static void append(final StringBuilder sbString, final String... strings)
public static void append(StringBuilder sbString, String... strings)
{
sbString.ensureCapacity(sbString.length() + getLength(strings));
@@ -239,7 +239,7 @@ public final class StringUtil
}
}
public static int getLength(final Iterable<String> strings)
public static int getLength(Iterable<String> strings)
{
int length = 0;
for (String string : strings)
@@ -254,7 +254,7 @@ public final class StringUtil
* @param strings array of strings
* @return total length of all the strings
*/
public static int getLength(final String[] strings)
public static int getLength(String[] strings)
{
int length = 0;
for (String string : strings)

View File

@@ -1215,7 +1215,7 @@ public final class BlowfishEngine
* @throws IllegalStateException The cipher was not yet initialized
* @throws IOException The source array is too small to hold a block at the given index
*/
public void tryEncryptBlock(byte[] src, final int srcIndex) throws IOException
public void tryEncryptBlock(byte[] src, int srcIndex) throws IOException
{
if (workingKey == null)
{
@@ -1239,7 +1239,7 @@ public final class BlowfishEngine
* @throws IllegalStateException The cipher was not yet initialized
* @throws IOException The source or destination array is too small to hold a block at the given index
*/
public void tryEncryptBlock(final byte[] src, final int srcIndex, byte[] dst, final int dstIndex) throws IOException
public void tryEncryptBlock(byte[] src, int srcIndex, byte[] dst, int dstIndex) throws IOException
{
if (workingKey == null)
{
@@ -1269,7 +1269,7 @@ public final class BlowfishEngine
* @param src source array with the plain data
* @param srcIndex index where the block to encrypt is located
*/
public void encryptBlock(byte[] src, final int srcIndex)
public void encryptBlock(byte[] src, int srcIndex)
{
encryptBlock(src, srcIndex, src, srcIndex);
}
@@ -1288,7 +1288,7 @@ public final class BlowfishEngine
* @param dst destination array the encryption will go to
* @param dstIndex index where the encrypted block is to be stored
*/
public void encryptBlock(final byte[] src, final int srcIndex, byte[] dst, final int dstIndex)
public void encryptBlock(byte[] src, int srcIndex, byte[] dst, int dstIndex)
{
int xl = bytesTo32bits(src, srcIndex);
int xr = bytesTo32bits(src, srcIndex + 4);
@@ -1325,7 +1325,7 @@ public final class BlowfishEngine
* @throws IllegalStateException The cipher was not yet initialized
* @throws IOException The source array is too small to hold a block at the given index
*/
public void tryDecryptBlock(byte[] src, final int srcIndex) throws IOException
public void tryDecryptBlock(byte[] src, int srcIndex) throws IOException
{
if (workingKey == null)
{
@@ -1348,7 +1348,7 @@ public final class BlowfishEngine
* @throws IllegalStateException The cipher was not yet initialized
* @throws IOException The source or destination array is too small to hold a block at the given index
*/
public void tryDecryptBlock(final byte[] src, final int srcIndex, byte[] dst, final int dstIndex) throws IOException
public void tryDecryptBlock(byte[] src, int srcIndex, byte[] dst, int dstIndex) throws IOException
{
if (workingKey == null)
{
@@ -1378,7 +1378,7 @@ public final class BlowfishEngine
* @param src source array with the encrypted data
* @param srcIndex index where the block to decrypt is located
*/
public void decryptBlock(byte[] src, final int srcIndex)
public void decryptBlock(byte[] src, int srcIndex)
{
decryptBlock(src, srcIndex, src, srcIndex);
}
@@ -1398,7 +1398,7 @@ public final class BlowfishEngine
* @param dstIndex index where the decrypted block is to be stored
* @throws IllegalStateException The cipher was not yet initialized
*/
public void decryptBlock(final byte[] src, final int srcIndex, byte[] dst, final int dstIndex)
public void decryptBlock(byte[] src, int srcIndex, byte[] dst, int dstIndex)
{
int xl = bytesTo32bits(src, srcIndex);
int xr = bytesTo32bits(src, srcIndex + 4);

View File

@@ -66,7 +66,7 @@ public class LoginCrypt
* @return true when checksum could be verified, false otherwise
* @throws IOException the size is not multiple of blowfishs block size or the raw array can't hold size bytes starting at offset due to it's size
*/
public boolean decrypt(byte[] raw, final int offset, final int size) throws IOException
public boolean decrypt(byte[] raw, int offset, int size) throws IOException
{
if ((size % 8) != 0)
{
@@ -90,7 +90,7 @@ public class LoginCrypt
* @return the new array size
* @throws IOException packet is too long to make padding and add verification data
*/
public int encrypt(byte[] raw, final int offset, int size) throws IOException
public int encrypt(byte[] raw, int offset, int size) throws IOException
{
// reserve checksum
size += 4;

View File

@@ -47,7 +47,7 @@ public final class NewCrypt
* @param raw data array to be verified
* @return true when the checksum of the data is valid, false otherwise
*/
public static boolean verifyChecksum(final byte[] raw)
public static boolean verifyChecksum(byte[] raw)
{
return NewCrypt.verifyChecksum(raw, 0, raw.length);
}
@@ -60,7 +60,7 @@ public final class NewCrypt
* @param size number of bytes to verify
* @return true if the checksum of the data is valid, false otherwise
*/
public static boolean verifyChecksum(final byte[] raw, final int offset, final int size)
public static boolean verifyChecksum(byte[] raw, int offset, int size)
{
// check if size is multiple of 4 and if there is more then only the checksum
if (((size & 3) != 0) || (size <= 4))
@@ -95,7 +95,7 @@ public final class NewCrypt
* Equivalent to calling {@link #appendChecksum(byte[], int, int)} with parameters (raw, 0, raw.length)
* @param raw data array to compute the checksum from
*/
public static void appendChecksum(final byte[] raw)
public static void appendChecksum(byte[] raw)
{
NewCrypt.appendChecksum(raw, 0, raw.length);
}
@@ -106,7 +106,7 @@ public final class NewCrypt
* @param offset offset where to start in the data array
* @param size number of bytes to compute the checksum from
*/
public static void appendChecksum(final byte[] raw, final int offset, final int size)
public static void appendChecksum(byte[] raw, int offset, int size)
{
long chksum = 0;
final int count = size - 4;
@@ -153,7 +153,7 @@ public final class NewCrypt
* @param size Length of the data to be encrypted
* @param key The 4 bytes (int) XOR key
*/
static void encXORPass(byte[] raw, final int offset, final int size, int key)
static void encXORPass(byte[] raw, int offset, int size, int key)
{
final int stop = size - 8;
int pos = 4 + offset;
@@ -192,7 +192,7 @@ public final class NewCrypt
* @param offset the offset at which to start decrypting
* @param size the number of bytes to be decrypted
*/
public void decrypt(byte[] raw, final int offset, final int size)
public void decrypt(byte[] raw, int offset, int size)
{
for (int i = offset; i < (offset + size); i += 8)
{
@@ -208,7 +208,7 @@ public final class NewCrypt
* @param offset the offset at which to start decrypting
* @param size the number of bytes to be decrypted
*/
public void crypt(byte[] raw, final int offset, final int size)
public void crypt(byte[] raw, int offset, int size)
{
for (int i = offset; i < (offset + size); i += 8)
{