MCPcopy Index your code
hub / github.com/apache/groovy / main

Method main

benchmark/bench/wc.java:16–46  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

14
15public class wc {
16 public static void main(String[] args) {
17 int nl = 0, nw = 0, nc = 0;
18
19 try {
20 byte[] buff = new byte[4096];
21 boolean inword = false;
22 int length;
23 char c;
24
25 while ((length = System.in.read(buff)) != -1) {
26 nc += length;
27 for(int i = 0; i < length; i++) {
28 c = (char)buff[i];
29 if (c == '\n')
30 ++nl;
31 if (Character.isWhitespace(c))
32 inword = false;
33 else if (inword == false) {
34 ++nw;
35 inword = true;
36 }
37 }
38 }
39 } catch (IOException e) {
40 System.err.println(e);
41 return;
42 }
43 System.out.println(Integer.toString(nl) + " " +
44 Integer.toString(nw) + " " +
45 Integer.toString(nc));
46 }
47}

Callers

nothing calls this directly

Calls 4

isWhitespaceMethod · 0.80
readMethod · 0.65
toStringMethod · 0.65
printlnMethod · 0.45

Tested by

no test coverage detected