- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Java Program to decode string to integer
The method Integer.decode() decodes a string to an integer. It returns an Integer object holding the int value represented by the passed string value.
Note − It accepts decimal, hexadecimal, and octal number.
Let’s say the following is our string.
String val = "2";
The following is how you can decode the string to integer.
Integer myInt = Integer.decode(val);
Example
public class Demo { public static void main(String []args) { String val = "2"; Integer myInt = Integer.decode(val); System.out.println("Integer = " + myInt); } }
Output
Integer = 2
- Related Articles
- Java Program to convert from integer to String
- Java Program to convert from String to integer
- Java Program to convert String to Integer using Integer.parseInt()
- Java Program to convert integer to String with Map
- How to convert String to Integer and Integer to String in Java?
- Program to convert List of Integer to List of String in Java
- Program to convert List of String to List of Integer in Java
- Program to convert Set of Integer to Set of String in Java
- Program to convert set of String to set of Integer in Java
- C# Program to Convert Integer to String
- C# program to convert binary string to Integer
- Convert Integer to Hex String in Java
- How to decode the string in android?
- Function to decode a string in JavaScript
- Java Program to convert integer to octal

Advertisements