List of usage examples for java.util Arrays deepToString
public static String deepToString(Object[] a)
From source file:Main.java
public static void main(String args[]) { String s[] = { "a", "b", "c", "d" }; double d[][] = { { 0.50, 0.20, 0.20, 0.30 }, { 0.50, 1.10, 0.50, 0.80 }, { 0.50, 0.70, 0.40 }, { 0.50, 0.70 }, { 0.50 }, }; System.out.println(Arrays.toString(s)); System.out.println(Arrays.deepToString(d)); }
From source file:Main.java
public static void main(String[] args) { int[][] array = new int[2][10]; Random rand = new Random(); for (int i = 0; i < 10; i++) { array[0][i] = i;//from w w w . j av a 2 s. c om array[1][i] = (int) rand.nextInt(3) + 1; } System.out.println(Arrays.deepToString(array)); }
From source file:Main.java
public static void main(String[] argv) { IntFunction<int[][]> TwoDimArrayCreator = int[][]::new; int[][] intArray = TwoDimArrayCreator.apply(5); // Creates an int[5][] array intArray[0] = new int[5]; intArray[1] = new int[5]; intArray[2] = new int[5]; intArray[3] = new int[5]; intArray[4] = new int[5]; System.out.println(Arrays.deepToString(intArray)); }
From source file:Main.java
public static void main(String[] args) { double[][] arr = new double[2][4]; fillRowsWithZeros(arr, arr.length - 1, arr[0].length); System.out.println(Arrays.deepToString(arr)); }
From source file:Main.java
public static void main(String[] args) { Object[][] ob = new Object[][] { { "java2s.com", "tutorial from java2s.com" }, { "java2s.com", "tutorial from java2s.com" }, { "java2s.com", "tutorial from java2s.com" }, { "java2s.com", "tutorial from java2s.com" }, { "java2s.com", "tutorial from java2s.com" }, { "java2s.com", "tutorial from java2s.com" }, { "java2s.com", "tutorial from java2s.com" }, { "java2s.com", "tutorial from java2s.com" }, }; System.out.println(Arrays.deepToString(ob)); }
From source file:Main.java
public static void main(String[] args) { char array[][] = new char[5][5]; Random rnd = new Random(); for (int i = 0; i < 5; i++) { for (int j = 0; j < 5; j++) { int x = rnd.nextInt(5); // 0 to 4 switch (x) { case 0: { array[i][j] = 'a'; break; }/*from w w w .j ava2 s. co m*/ case 1: { array[i][j] = 'b'; break; } case 2: { array[i][j] = 'c'; break; } case 3: { array[i][j] = 'd'; break; } case 4: { array[i][j] = 'e'; break; } } } } System.out.println(Arrays.deepToString(array)); }
From source file:org.wso2.carbon.sample.performance.Client.java
public static void main(String[] args) { log.info(Arrays.deepToString(args)); try {//from w ww . j a va 2 s .c o m log.info("Starting WSO2 Performance Test Client"); AgentHolder.setConfigPath(DataPublisherUtil.getDataAgentConfigPath()); DataPublisherUtil.setTrustStoreParams(); String protocol = args[0]; String host = args[1]; String port = args[2]; String username = args[3]; String password = args[4]; String eventCount = args[5]; String elapsedCount = args[6]; String warmUpCount = args[7]; String calcType = args[8]; //create data publisher DataPublisher dataPublisher = new DataPublisher(protocol, "tcp://" + host + ":" + port, null, username, password); //Publish event for a valid stream if ("latency".equalsIgnoreCase(calcType)) { publishEventsForLatency(dataPublisher, Long.parseLong(eventCount), Long.parseLong(elapsedCount), Long.parseLong(warmUpCount)); } else { publishEvents(dataPublisher, Long.parseLong(eventCount), Long.parseLong(elapsedCount), Long.parseLong(warmUpCount)); } dataPublisher.shutdownWithAgent(); } catch (Throwable e) { log.error(e); } }
From source file:org.wso2.carbon.sample.wso2event.Client.java
public static void main(String[] args) { System.out.println(Arrays.deepToString(args)); try {//from w w w . j a va 2 s. c o m System.out.println("Starting WSO2 Event Client"); AgentHolder.setConfigPath(DataPublisherUtil.getDataAgentConfigPath()); DataPublisherUtil.setTrustStoreParams(); String protocol = args[0]; String host = args[1]; String port = args[2]; String username = args[3]; String password = args[4]; String streamId = args[5]; String sampleNumber = args[6]; String filePath = args[7]; int events = Integer.parseInt(args[8]); int delay = Integer.parseInt(args[9]); Map<String, StreamDefinition> streamDefinitions = DataPublisherUtil.loadStreamDefinitions(sampleNumber); if (streamId == null || streamId.length() == 0) { throw new Exception("streamId not provided"); } StreamDefinition streamDefinition = streamDefinitions.get(streamId); if (streamDefinition == null) { throw new Exception("StreamDefinition not available for stream " + streamId); } else { log.info("StreamDefinition used :" + streamDefinition); } filePath = DataPublisherUtil.getEventFilePath(sampleNumber, streamId, filePath); //create data publisher DataPublisher dataPublisher = new DataPublisher(protocol, "tcp://" + host + ":" + port, null, username, password); //Publish event for a valid stream publishEvents(dataPublisher, streamDefinition, filePath, events, delay); dataPublisher.shutdownWithAgent(); } catch (Throwable e) { log.error(e); } }
From source file:org.wso2.carbon.sample.kafka.Kafka.java
public static void main(String args[]) { log.info("Command line arguments passed: " + Arrays.deepToString(args)); log.info("Starting Kafka Client"); String url = args[0];/*from ww w . j a va 2 s . co m*/ String topic = args[1]; String filePath = args[2]; String sampleNumber = args[3]; Properties props = new Properties(); props.put("metadata.broker.list", url); props.put("serializer.class", "kafka.serializer.StringEncoder"); ProducerConfig config = new ProducerConfig(props); Producer<String, Object> producer = new Producer<String, Object>(config); try { filePath = KafkaUtil.getEventFilePath(sampleNumber, topic, filePath); readMsg(filePath); for (String message : messagesList) { System.out.println("Sending message:"); System.out.println(message); KeyedMessage<String, Object> data = new KeyedMessage<String, Object>(topic, message); producer.send(data); } Thread.sleep(500); } catch (Throwable t) { log.error("Error when sending the messages", t); } finally { producer.close(); } }
From source file:org.wso2.carbon.sample.isanalyticsclient.Client.java
public static void main(String[] args) { DataPublisherUtil.setKeyStoreParams(); DataPublisherUtil.setTrustStoreParams(); log.info("These are the provided configurations: " + Arrays.deepToString(args)); String protocol = args[0];/*from w ww. jav a 2 s . c om*/ String host = args[1]; String port = args[2]; int sslPort = Integer.parseInt(port) + 100; String username = args[3]; String password = args[4]; String numberOfEventsStr = args[5]; int numberOfEvents = Integer.parseInt(numberOfEventsStr); int metaTenantIdMinBound = 1000; int metaTenantIdMaxBound = 9999; try { log.info("Starting IS Analytics Event Client"); AgentHolder.setConfigPath(DataPublisherUtil.getDataAgentConfigPath(agentConfigFileName)); DataPublisher dataPublisher = new DataPublisher(protocol, "tcp://" + host + ":" + port, "ssl://" + host + ":" + sslPort, username, password); Event authEvent = new Event(); authEvent.setStreamId(DataBridgeCommonsUtils.generateStreamId(STREAM_NAME, VERSION)); authEvent.setCorrelationData(null); Event sessionEvent = new Event(); sessionEvent.setStreamId(DataBridgeCommonsUtils.generateStreamId(SESSION_STREAM_NAME, VERSION)); for (int i = 0; i < numberOfEvents; i++) { int metaTenantId = ThreadLocalRandom.current().nextInt(metaTenantIdMinBound, metaTenantIdMaxBound); Object[] data = getEventDataObject(); authEvent.setMetaData(new Object[] { metaTenantId }); authEvent.setPayloadData(data); Object[] sessionData = getEventDataObjectForSession(data); sessionEvent.setMetaData(new Object[] { metaTenantId }); sessionEvent.setPayloadData(sessionData); dataPublisher.publish(authEvent); dataPublisher.publish(sessionEvent); } try { Thread.sleep(5000); } catch (InterruptedException e) { log.error(e); } dataPublisher.shutdown(); log.info("Events published successfully"); } catch (Throwable e) { log.error(e); } }