SHARE
TWEET

Untitled

a guest Jun 19th, 2017 43 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public class exo5 {
  2.     public static void main(String args[]){
  3.  
  4.     String exe = " ";
  5.     exe = args [0];
  6.     System.out.println("before exe = " + exe);
  7.     exe = buildString ( exe);
  8.     System.out.println( " after exe = " + exe);
  9. }
  10.  
  11.  
  12.  
  13. public static String buildString(String s) {
  14.     String r="";
  15.     for(int i=0 ; i<s.length() ; i++){
  16.         if(keepChar(s.charAt(i),i)) {
  17.         r=r+s.charAt(i);
  18.         }
  19.     }
  20.     return r;
  21. }
  22.  
  23. public static boolean keepChar(char c,int position) {
  24.     if(position%2==1){
  25.         return true;
  26.     }else{
  27.         return false;
  28. }
  29. }
  30. }
RAW Paste Data
Pastebin PRO Summer Special!
Get 40% OFF on Pastebin PRO accounts!
Top