title: How to convert a int to byte?
body: <p>I just trying to figure out how to convert an int number into byte.
  It sounds easy, but for me it's hard to know how to convert it.</p>
  
  <p>For e.g:</p>
  
  <pre><code>    public byte[] getByteArray(String ipOrMac){
  
          String[] temp = new String[0];
          ArrayList&lt;Integer&gt; intList = new ArrayList&lt;Integer&gt;();
  
          if(ipOrMac.contains(":")){
              temp = ipOrMac.split(":"); // this makes temp into a new Array
                                         //with splitted strings
          }
  
          if(ipOrMac.contains(".")){
              temp = ipOrMac.split(".");
          }
  
          for(int a = 0; a&lt;=temp.length-1; a++){
              intList.add(Integer.parseInt(temp[a]));
          }
  
  //      System.out.println(stringList.toArray()[0]);
  //      for(int a = 0; a&lt;=stringList.size()-1; a++){
  //          stringList.
  //      }
  
          return null;
      }
  </code></pre>
  
  <p>My maintarget is to get a String like this "2:2:2:2" (it's a mac-adress)
  into a byte[].
  So now I have the problem to convert all the ints in my arraylist-integer to bytes.
  I don't want to use an arraylist-byte because it's inefficient...</p>
  
  <p>So any ideas?</p>
  
  <p>Hope you can help me. :)</p>