About 50 results
Open links in new tab
  1. Java reverse an int value without using array - Stack Overflow

    Sep 28, 2010 · Java reverse an int value - Principles Modding (%) the input int by 10 will extract off the rightmost digit. example: (1234 % 10) = 4 Multiplying an integer by 10 will "push it left" exposing a …

  2. How do I reverse an int array in Java? - Stack Overflow

    Jan 26, 2010 · I am trying to reverse an int array in Java. This method does not reverse the array.

  3. java - How to reverse digits of integer? - Stack Overflow

    An easy way to reverse an integer is to parse it into a string, reverse it, and parse it back into a integer.

  4. java - Reverse an int using recursion - Stack Overflow

    Oct 4, 2021 · You don't need two int s in your reverse2 function if you want to create a "print reverse integer" function using recursion. It looks like you know how to get the rightmost digit with the % 10 …

  5. java - LeetCode 7: Reverse Integer | why does it work with a long but ...

    May 14, 2022 · I was trying to solve this problem on LeetCode where you have to reverse an integer using a function. The constraint is that if the reversed number goes outside the signed 32-bit integer …

  6. java - Reverse Integer (Leetcode) - Stack Overflow

    Jan 15, 2022 · Given a signed 32-bit integer x, return x with its digits reversed. If reversing x causes the value to go outside the signed 32-bit integer range [-2^31, 2^31 - 1], then return 0.

  7. list - How can I reverse a Java 8 stream and generate a decrementing ...

    Both end up storing the stream elements. I don't know of a way to reverse a stream without storing the elements. This first way stores the elements into an array and reads them out to a stream in reverse …

  8. Reverse Integer leetcode -- how to handle overflow

    The problem is: Reverse digits of an integer. Example1: x = 123, return 321 Example2: x = -123, return -321 Did you notice that the reversed integer might overflow? Assume the input is a 32-bit integer, …

  9. java - inputing negative numbers into a number reversal program

    Jul 20, 2016 · My program is supposed to take in random integers and reverse them. It currently works for all positive integers that are no more than ten digits long. import java.util.Scanner; public class Pro...

  10. java - Reverse bits in number - Stack Overflow

    Jul 2, 2010 · 0 My new java code reverse bits in an integer using java with powerful bit manipulation. It is working with positive, negative and zero values. Hope it helps.