public static void main(String[] args) throws IOException { InputHandler ih = new InputHandler(args[0]); Solution sol = new Solution(); ArrayList<int[]> inIntList = ih.getDataAsIntList(); for (int i = 0; i < inIntList.size(); i++) { int n = inIntList.get(i)[0]; System.out.println(sol.isPalindrome(n)); } }
private void connect() throws UnknownHostException, IOException { IrcServer = new Socket(serverName, 6667); BufferedReader br = new BufferedReader( new InputStreamReader(IrcServer.getInputStream(), BotStats.getInstance().getCharset())); PrintWriter pw = new PrintWriter( new OutputStreamWriter( IrcServer.getOutputStream(), BotStats.getInstance().getCharset()), true); ih = new InputHandler(br); oh = new OutputHandler(pw); ih.start(); oh.start(); new Message("", "NICK", BotStats.getInstance().getBotname(), "").send(); new Message( "", "USER", "goat" + " nowhere.com " + serverName, BotStats.getInstance().getVersion()) .send(); // we sleep until we are connected, don't want to send these next messages too soon while (!connected) { try { sleep(100); } catch (InterruptedException e) { e.printStackTrace(); } } joinChannels(); }
protected void setCharset(Charset cs) { try { BufferedReader br = new BufferedReader(new InputStreamReader(IrcServer.getInputStream(), cs)); PrintWriter pw = new PrintWriter(new OutputStreamWriter(IrcServer.getOutputStream(), cs), true); ih.setBR(br); oh.setOSW(pw); } catch (IOException e) { e.printStackTrace(); } catch (Exception e) { System.err.println("Unexpected exception in setCharset :"); e.printStackTrace(); } }