Java Integer Create toInt(String string)

Here you can find the source of toInt(String string)

Description

to Int

License

Open Source License

Declaration

public static int toInt(String string) 

Method Source Code

//package com.java2s;

public class Main {
    public static int toInt(String string) {
        if (string.length() != 4)
            throw new IllegalArgumentException(
                    "length must be 4, got \"" + string + "\", length=" + string.length());
        byte[] bytes = string.getBytes();
        return ((bytes[0] & 0xFF) << 24) | ((bytes[1] & 0xFF) << 16) | ((bytes[2] & 0xFF) << 8) | (bytes[3] & 0xFF);
    }//from w  w  w.j  a  v a2 s .  c  o m
}

Related

  1. toInt(String str, int defaultValue)
  2. toInt(String str, int defValue)
  3. toInt(String str, int val)
  4. toInt(String string)
  5. ToInt(String string)
  6. toInt(String string)
  7. toInt(String string)
  8. toInt(String string, int defaultValue)
  9. toInt(String string, int defaultValue)