Skip to content

Instantly share code, notes, and snippets.

@pabloleonalcaide
Created October 4, 2016 17:31
Show Gist options
  • Save pabloleonalcaide/6e8d02a05341b00953186ff16c11dea3 to your computer and use it in GitHub Desktop.
Save pabloleonalcaide/6e8d02a05341b00953186ff16c11dea3 to your computer and use it in GitHub Desktop.
public class LongUnsigned {
public static void main(String[]args){
//Este método acepta como parámetro una cadena de caracteres, lo que permite el uso de un valor mayor
long number = Long.parseUnsignedLong("17916881237904312345");
//Para poder visualizar esta variable tenemos que hacer uso del método toUNsignedString()
String numberStr = Long.toUnsignedString(number);
System.out.println(numberStr);
System.out.println(number);
//compareUnsigned(long, long) --> nos permite comparar dos valores tratándolos como variable sin signo.
/*divideUnsigned(long, long) --> permite dividir ambas variables como sin signo y tratar el resultado del
* mismo modo
*/
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment