It looks like there’s an extra space character in your string. You can use trim()
to remove leading and trailing whitespaces:
temp1 = Integer.parseInt(display.getText().trim(), 16 );
Or if you think the presence of a space means there’s something else wrong, you’ll have to look into it yourself, since we don’t have the rest of your code.
Related Posts:
- How do I convert a String to an int in Java?
- How to convert a char to a String?
- Convert String to double in Java
- How can I convert a char to int in Java? [duplicate]
- Create ArrayList from array
- Convert an integer to an array of characters : java
- Convert hex string to int
- Converting A String To Hexadecimal In Java
- How to convert a byte array to a hex string in Java?
- Convert double to Int, rounded down
- Converting from byte to int in Java
- Conversion from Long to Double in Java
- Could not reserve enough space for object heap
- What does “Could not find or load main class” mean?
- Exception in thread “main” java.util.NoSuchElementException
- “Error occurred during initialization of VM; Could not reserve enough space for object heap” using -Xmx3G
- What’s the simplest way to print a Java array?
- javax vs java package
- What is a stack trace, and how can I use it to debug my application errors?
- How to fix “A JNI error has occurred, please check your installation.”
- Java Runtime Environment not found error when I open an application
- “PKIX path building failed” and “unable to find valid certification path to requested target”
- What exactly does a jar file contain?
- Java optional parameters
- Understanding Spring @Autowired usage
- How to update a value, given a key in a hashmap?
- How to schedule a periodic task in Java?
- typeof in Java 8
- Switch on Enum in Java
- error upon assigning Layout: BoxLayout can’t be shared
- Why do this() and super() have to be the first statement in a constructor?
- Else without if
- Keytool is not recognized as an internal or external command
- Cannot find “Package Explorer” view in Eclipse
- Error: Could not find or load main class in intelliJ IDE
- Java Hashmap: How to get key from value?
- Understanding the difference between null and ‘\u000’ in Java
- What’s the difference between import java.util.*; and import java.util.stream;?
- No enclosing instance of type is accessible.
- How to remove single character from a String
- What is the best math library to use with java?
- What is the difference between a null array and an empty array?
- Why is there no String.Empty in Java?
- How to initialize List
object in Java? - PrintWriter append method not appending
- Using ADB to capture the screen
- What is the difference between response.sendRedirect() and request.getRequestDispatcher().forward(request,response)
- Recursion vs. Iteration (Fibonacci sequence)
- What is difference between Errors and Exceptions?
- How do I use the JAVA_OPTS environment variable?
- What is the difference between iterator and iterable and how to use them?
- Netbeans installation doesn’t find JDK
- Convert String to int array in java
- eclipse won’t start – no java virtual machine was found
- What causes “‘void’ type not allowed here” error
- Variable might not have been initialized error
- Java substring: ‘string index out of range’
- throw checked Exceptions from mocks with Mockito
- How to sort an array of objects in Java?
- Android – SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
- Java GUI: about getContentPane( ) method and content
- Hibernate Error: a different object with the same identifier value was already associated with the session
- How to solve the “failed to lazily initialize a collection of role” Hibernate exception
- Initializing multiple variables to the same value in Java
- Java: Unresolved compilation problem
- FXML Load exception
- NullPointerExcetion Native Method Accessor… Hashing Words Issue
- How to convert currentTimeMillis to a date in Java?
- How to clear console in Java – Eclipse
- Java TreeMap Comparator
- Get keys from HashMap in Java
- Determine if a String is an Integer in Java [duplicate]
- How do I run Java .class files?
- Fill an array with random numbers [duplicate]
- Connection Java – MySQL : Public Key Retrieval is not allowed
- Whitespace Matching Regex – Java
- Size has private access in ArrayList
- Iterator for a linkedlist
- Hide Utility Class Constructor : Utility classes should not have a public or default constructor
- Android – Start service on boot
- JsonMappingException: No suitable constructor found for type [simple type, class ]: can not instantiate from JSON object
- Sending POST data in Android
- Keylistener not working for JPanel
- the getSource() and getActionCommand()
- Failed to install android-sdk: “java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema”
- Maven build Compilation error : Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project Maven
- Regex pattern including all special characters
- Error: ‘)’ expected compiler error
- How does addNotify() and requestFocus() work in Java with JPanel?
- DTO and DAO concepts and MVC
- How to extract .war files in java? ZIP vs JAR
- What is the difference between run-time error and compiler error?
- What is the difference between ArrayList.clear() and ArrayList.removeAll()?
- Test if element is present using Selenium WebDriver?
- Increase heap size in Java
- How to print a table of information in Java
- set background color: Android
- Class Declarations for temperature program in Java
- Spring Boot – Cannot determine embedded database driver class for database type NONE
- Convert double to float in Java