public static double CompressionTestStatistics(int[] S)
byte[] compAOB;
ByteArrayOutputStream byteArrOutStream;
double invalidOut;
double T;
int byteLenOfCompAOB;
int i;
OutputStream outStream;
String errorMsg;
String SWithSpace;
char[] SWithSpaceChar;
StringWriter error;
SWithSpaceChar = new char[[Link] * 2 - 1];
i = 0;
while (i < [Link] - 2)
{
SWithSpaceChar[i] = (char) (S[i / 2] + '0');
i++;
SWithSpaceChar[i] = ' ';
i++;
}
// Last Char
SWithSpaceChar[i] = (char) (S[i / 2] + '0');
SWithSpace = new String(SWithSpaceChar);
byteArrOutStream = new ByteArrayOutputStream();
if (isMultiThreaded)
{
BZip2EncoderExecutorService executor =
[Link](NUM_CORES);
BZip2OutputStreamSettings settings = new
BZip2OutputStreamSettings().setExecutorService(executor).setNumberOfEncoderThreads(
NUM_CORES);
try
{
outStream = new BZip2OutputStream(byteArrOutStream, settings);
try
{
[Link]([Link]());
}
finally
{
[Link]();
}
compAOB = [Link]();;
byteLenOfCompAOB = [Link];
T = (double) (byteLenOfCompAOB);
[Link]();
return (T);
}
catch (IOException e)
{
error = new StringWriter();
[Link](new PrintWriter(error));
errorMsg = "Compression Test Statistics tidak dapat diimplementasi
karena adanya eror berikut :\n" + [Link]();
[Link](errorMsg);
invalidOut = -1d;
[Link]();
return (invalidOut);
}
finally
{
[Link]();
}
}
else
{
try
{
outStream = new BZip2OutputStream(byteArrOutStream);
try
{
[Link]([Link]());
}
finally
{
[Link]();
}
compAOB = [Link]();
byteLenOfCompAOB = [Link];
T = (double) (byteLenOfCompAOB);
return (T);
}
catch (IOException e)
{
error = new StringWriter();
[Link](new PrintWriter(error));
errorMsg = "Compression Test Statistics tidak dapat diimplementasi
karena adanya eror berikut :\n" + [Link]();
[Link](errorMsg);
invalidOut = -1d;
return (invalidOut);
}
}
}