Creates a size byte long unicode string. All codes are &gt;= start and &lt; start+length

@param size number of characters in the return string
@param start start code
@param length all generated codes are within this range
@return
356251
public static String getRandomString(final int size, final int start, final int length) {
		final StringBuilder buff = new StringBuilder(size);

		for (int i = 0; i < size; i++) {
			buff.append((char) (RAN.nextInt(length) + start));
		}
		return buff.toString();
	}
320338
public static String rightPad( String value , int size , char padChar )
    {
        if (value.length() >= size)
            return value;
        
        StringBuilder result = new StringBuilder(size);
        result.append(value);
        for (int n = 0 ; n < size-value.length() ; n++)
            result.append(padChar);        
        return result.toString();
    }
149619
@SuppressWarnings("fallthrough")
    public static long convertToMachineFriendlyByteSize(String size) {
        double d;
        try {
            d = Double.parseDouble(size.replaceAll("[GMK]?[B]?$", ""));
        } catch (NumberFormatException e)  {
            String msg = "Size must be specified as bytes (B), " +
                    "kilobytes (KB), megabytes (MB), gigabytes (GB). " +
                    "E.g. 1024, 1KB, 10M, 10MB, 100G, 100GB";
            throw new NumberFormatException(msg + " " + e.getMessage());
        }
        long l = Math.round(d * 1024 * 1024 * 1024L);
        int index = Math.max(0, size.length() - (size.endsWith("B") ? 2 : 1));
        switch (size.charAt(index)) {
            default:  l /= 1024;
            case 'K': l /= 1024;
            case 'M': l /= 1024;
            case 'G': return l;
        }
    }
1258336
public void writeLength(long length) {
    if (length < 251) {
      buf[position++] = (byte) length;
    } else if (length < 65536) {
      buf[position++] = (byte) 0xfc;
      buf[position++] = (byte) length;
      buf[position++] = (byte) (length >>> 8);
    } else if (length < 16777216) {
      buf[position++] = (byte) 0xfd;
      buf[position++] = (byte) length;
      buf[position++] = (byte) (length >>> 8);
      buf[position++] = (byte) (length >>> 16);
    } else {
      buf[position++] = (byte) 0xfe;
      buf[position++] = (byte) length;
      buf[position++] = (byte) (length >>> 8);
      buf[position++] = (byte) (length >>> 16);
      buf[position++] = (byte) (length >>> 24);
      buf[position++] = (byte) (length >>> 32);
      buf[position++] = (byte) (length >>> 40);
      buf[position++] = (byte) (length >>> 48);
      buf[position++] = (byte) (length >>> 54);
    }
  }
242364
public boolean isWhitespace(int start, int length)
  {

    int sourcechunk = start >>> m_chunkBits;
    int sourcecolumn = start & m_chunkMask;
    int available = m_chunkSize - sourcecolumn;
    boolean chunkOK;

    while (length > 0)
    {
      int runlength = (length <= available) ? length : available;

      if (sourcechunk == 0 && m_innerFSB != null)
        chunkOK = m_innerFSB.isWhitespace(sourcecolumn, runlength);
      else
        chunkOK = org.apache.xml.utils.XMLCharacterRecognizer.isWhiteSpace(
          m_array[sourcechunk], sourcecolumn, runlength);

      if (!chunkOK)
        return false;

      length -= runlength;

      ++sourcechunk;

      sourcecolumn = 0;
      available = m_chunkSize;
    }

    return true;
  }
169575
public ByteArray readBytes(int size) throws IOException
   {
      byte[] data = new byte[size];
      m_stream.read(data);
      return new ByteArray(data);
   }
797680
public static UTF8String blankString(int length) {
    byte[] spaces = new byte[length];
    Arrays.fill(spaces, (byte) ' ');
    return fromBytes(spaces);
  }
91236
protected static final int nextStringLength(byte[] bytes, int startPos, int length, char delimiter) {
		if (length <= 0) {
			throw new IllegalArgumentException("Invalid input: Empty string");
		}
		int limitedLength = 0;
		final byte delByte = (byte) delimiter;

		while (limitedLength < length && bytes[startPos + limitedLength] != delByte) {
			limitedLength++;
		}

		return limitedLength;
	}
1020098
public static String randomString(final int size) {
        final StringBuilder builder = new StringBuilder();
        while (builder.length() < size) {
            final String suffix = java.util.UUID.randomUUID().toString().replace("-", "");
            builder.append(suffix);
        }
        return builder.substring(0, size);
    }
17451
public static String randomAsciiFixLength(Random random, int length) {
		return RandomStringUtils.random(length, 32, 127, false, false, null, random);
	}
278423
public static String asIbi(long size) {
        if (size > GIBI) {
            return String.format("%.1f GiB", (size / GIBI));
        } else if (size > MIBI) {
            return String.format("%.1f MiB", (size / MIBI));
        } else if (size > KIBI) {
            return String.format("%.1f KiB", (size / KIBI));
        } else {
            return String.format("%d B", size);
        }
    }
815545
protected IntBuffer createIntBuffer(int size) {
      ByteBuffer temp = ByteBuffer.allocateDirect(4 * size);
      temp.order(ByteOrder.nativeOrder());

      return temp.asIntBuffer();
    }
664955
public static byte[] fold(byte[] bytes, int size) {
        byte[] r = new byte[size];
        for (int i=Math.max(bytes.length,size)-1; i>=0; i-- ) {
            r[i%r.length] ^= bytes[i%bytes.length];
        }
        return r;
    }
1074541
public static String encode(byte[] bytes) {
		int bytesLength = bytes.length;
		int base64Length = (bytesLength * 4 + 2) / 3; // base64 encoded string length, without padding

		StringBuilder base64Builder = new StringBuilder();
		int bytesIndex = 0;

		while (bytesIndex < bytesLength) {
			int i0 = bytes[bytesIndex++] & 0xff;
			int i1 = bytesIndex < bytesLength ? bytes[bytesIndex++] & 0xff : 0;
			int i2 = bytesIndex < bytesLength ? bytes[bytesIndex++] & 0xff : 0;

			int o0 = i0 >>> 2;
			int o1 = ((i0 & 3) << 4) | (i1 >>> 4);
			int o2 = ((i1 & 0xf) << 2) | (i2 >>> 6);
			int o3 = i2 & 0x3F;

			base64Builder.append(NIBLES_2_CHARS[o0]);
			base64Builder.append(NIBLES_2_CHARS[o1]);
			base64Builder.append(base64Builder.length() < base64Length ? NIBLES_2_CHARS[o2] : '=');
			base64Builder.append(base64Builder.length() < base64Length ? NIBLES_2_CHARS[o3] : '=');
		}

		return base64Builder.toString();
	}
281688
protected byte[] getBuffer(int size) {
    byte[] buffer;
    if (size > SERIALIZER_BUFFER_SIZE) {
      buffer = new byte[size];
    } else {
      buffer = serializerBuffers.get();
      serializerBuffers.remove();
    }
    return buffer;
  }
1235002
public byte[] getBytes(int size){ 
        _checkForRead(size);
        byte[] dst = new byte[size];
       _buf.get(dst, 0, size);
       return dst;
    }
221939
private String sizeToString(final long aSizeInBytes) {
        final String size = sizeFromBytes(aSizeInBytes, true).replace(" ", "");
        return size.substring(0, size.length() - 1);
    }