Example usage for org.apache.commons.lang ArrayUtils toString

List of usage examples for org.apache.commons.lang ArrayUtils toString

Introduction

In this page you can find the example usage for org.apache.commons.lang ArrayUtils toString.

Prototype

public static String toString(Object array) 

Source Link

Document

Outputs an array as a String, treating null as an empty array.

Usage

From source file:Main.java

public static void main(String[] args) {
    String[] colors = { "Red", "Green", "Blue", "Cyan", "Yellow", "Magenta" };
    System.out.println(ArrayUtils.toString(colors));

    ArrayUtils.reverse(colors);/*from w w  w  .jav a 2  s .c o m*/
    System.out.println(ArrayUtils.toString(colors));
}

From source file:ArrayUtilsExampleV1.java

public static void main(String args[]) {

    long[] longArray = new long[] { 10000, 30, 99 };
    String[] stringArray = new String[] { "abc", "def", "fgh" };

    long[] clonedArray = ArrayUtils.clone(longArray);
    System.err.println(ArrayUtils.toString((ArrayUtils.toObject(clonedArray))));

    System.err.println(ArrayUtils.indexOf(stringArray, "def"));

    ArrayUtils.reverse(stringArray);/*from  w  w  w.j  a va2 s .  c  om*/
    System.err.println(ArrayUtils.toString(stringArray));
}

From source file:CharSetExampleV1.java

public static void main(String args[]) {
    CharSet set = CharSet.getInstance("the apprentice");
    System.err.println(set.contains('q'));
    CharRange[] range = set.getCharRanges();

    System.err.println(ArrayUtils.toString(range));
}

From source file:com.discursive.jccook.math.SolveEquations.java

public static void main(String[] args) {

    double[][] coefficients = { { 3.0, 20.0, 89.0 }, { 4.0, 40.0, 298.0 }, { 7.0, 21.0, 0.42 } };

    double[] values = { 1324, 2999, 2039 };

    RealMatrix matrix = new RealMatrixImpl(coefficients);

    double[] answers = matrix.solve(values);

    System.out.println("Answers: " + ArrayUtils.toString(answers));

    double[][] badCoefficients = { { 1, 1, 1 }, { 1, 1, 1 }, { 1, 1, 1 } };

    double[] badValues = { 0, 1, 3 };

    matrix = new RealMatrixImpl(badCoefficients);

    answers = matrix.solve(badValues);/*w  ww .j ava 2 s. c o  m*/

    System.out.println("Answers: " + ArrayUtils.toString(answers));

}

From source file:edu.cornell.med.icb.goby.modes.GobyDriver.java

public static void main(final String[] args) throws IOException, JSAPException {
    final String version = VersionUtils.getImplementationVersion(GobyDriver.class);
    DynamicOptionRegistry.autoRegister();
    if (LOG.isDebugEnabled()) {
        LOG.debug(GobyDriver.class.getName() + " Implementation-Version: " + version);
        LOG.debug("Running with: " + ArrayUtils.toString(args));
    }/*  www.ja  v a 2s. c o  m*/
    int status = 0;
    try {
        new GobyDriver().configure(args).execute();
    } catch (Exception e) {
        e.printStackTrace();
        status = 1;
    }
    System.exit(status);
}

From source file:edu.cornell.med.icb.R.RConfigurationServer.java

public static void main(final String[] args) throws RemoteException {
    if (System.getSecurityManager() == null) {
        System.setSecurityManager(new SecurityManager());
    }/*from  w  w  w .j ava  2 s.  com*/

    final String name = "RConfiguration";
    final RConfiguration engine = new RConfigurationServer();
    final RConfiguration stub = (RConfiguration) UnicastRemoteObject.exportObject(engine, 0);
    final Registry registry = LocateRegistry.getRegistry();
    System.out.println(ArrayUtils.toString(registry.list()));
    registry.rebind(name, stub);
    System.out.println("RConfiguration bound");
}

From source file:com.talent.nio.utils.ByteUtils.java

public static void main(String[] args) throws IOException {
    byte[] bs = "1hello world\r\nhehe".getBytes();
    System.out.println(ArrayUtils.toString(bs));
    ByteBuf buf = Unpooled.copiedBuffer(bs);
    String xString = buf.toString();
    ByteUtils.toLinesList(buf);/*w  w w.j av  a  2s.c om*/

    bs = "2hello world hehe\r\n".getBytes();
    buf = Unpooled.copiedBuffer(bs);
    ByteUtils.toLinesList(buf);

    bs = "3hello world\r\nhehe\r\n\r\n".getBytes();
    buf = Unpooled.copiedBuffer(bs);
    ByteUtils.toLinesList(buf);

    bs = "4\rhe\nllo world\r\nhehe".getBytes();
    buf = Unpooled.copiedBuffer(bs);
    ByteUtils.toLinesList(buf);
}

From source file:com.liferay.tool.datamanipulator.util.GetterUtil.java

public static Class<?> getClass(String... classNames) throws ClassNotFoundException {

    for (String className : classNames) {
        try {/*from  ww w .  j av  a2  s  .  c o  m*/
            return getClass(className);
        } catch (ClassNotFoundException cnfe) {
        }
    }

    throw new ClassNotFoundException("Requested class not found: " + ArrayUtils.toString(classNames));
}

From source file:mailbox.IMAPMessageUtil.java

public static String asString(IMAPMessage msg) throws MessagingException {
    return String.format("{Subject: %s, From: %s, To: %s}", msg.getSubject(),
            ArrayUtils.toString(msg.getFrom()), ArrayUtils.toString(msg.getAllRecipients()));
}

From source file:net.sf.json.sample.ArrayJSONStringBean.java

public String toJSONString() {
    return ArrayUtils.toString(value.split(",")).replace('{', '[').replace('}', ']');
}