# Unsigned types and cast

**URL:** <https://discourse.processing.org/t/unsigned-types-and-cast/11285>\
**Category:** Beginners\
**Created:** [May 15, 2019, 7:46pm UTC](https://discourse.processing.org/t/unsigned-types-and-cast/11285 "2019-05-15T19:46:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![lve0200](https://avatars.discourse-cdn.com/v4/letter/l/aeb1de/32.png) [@lve0200](https://discourse.processing.org/u/lve0200)\
**Post date:** [May 15, 2019, 7:46pm UTC](https://discourse.processing.org/t/unsigned-types-and-cast/11285/1 "2019-05-15T19:46:36Z")

</div>

Hi,  
is there anything like unsigned, e.g. unsigned int?  
…  
or how to treat numbers which would after conversion long -\> int normally fall into minus??  
Is there anything like cast e.g.  
int COG = (int) location.getBearing();  
Rgds  
hk

---

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [May 15, 2019, 8:42pm UTC](https://discourse.processing.org/t/unsigned-types-and-cast/11285/2 "2019-05-15T20:42:25Z")

</div>

> [@lve0200](#):
>
> Is there anything like `unsigned`,

Outta the 8 Java primitives, only `char` is `unsigned`, although 16-bit only: ➕

> **[char / Reference](https://processing.org/reference/char.html)**
>
> Datatype for characters, typographic symbols such as A, d, and $. A char stores letters and symbols in the Unicode format, a coding system developed to support a variety of world languages. Eac…

But Java offers `unsigned` static methods within its primitive wrapper classes: ☕

- [Byte (Java SE 11 & JDK 11 )](http://Docs.Oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Byte.html)
- [Short (Java SE 11 & JDK 11 )](http://Docs.Oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Short.html)
- [Integer (Java SE 11 & JDK 11 )](http://Docs.Oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Integer.html)
- [Long (Java SE 11 & JDK 11 )](http://Docs.Oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Long.html)
