<p>This is a <a href="https://stackoverflow.com/questions/319199/why-is-java-able-to-store-0xff000000-as-an-int">follow up question</a>. So, Java store's integers in <a href="http://en.wikipedia.org/wiki/Two%27s_complement" rel="nofollow noreferrer">two's-complements</a> and you can do the following:</p>

<pre><code>int ALPHA_MASK = 0xff000000;
</code></pre>

<p>In C# this requires the use of an unsigned integer, <code>uint</code>, because it interprets this to be <code>4278190080</code> instead of <code>-16777216</code>.</p>

<p>My question, how do declare negative values in hexadecimal notation in c#, and how exactly are integers represented internally? What are the differences to Java here?</p>

C# (rather, .NET) also uses the two's complement, but it supports both signed and unsigned types (which Java doesn't). A bit mask is more naturally an unsigned thing - why should one bit be different than all the other bits?
In this specific case, it is safe to use an unchecked cast:
```
```
int ALPHA_MASK = unchecked((int)0xFF000000);
```
```
To "directly" represent this number as a signed value, you write
```
```
int ALPHA_MASK = -0x1000000; // == -16777216
```
```
Hexadecimal is not (or should not) be any different from decimal: to represent a negative number, you need to write a negative sign, followed by the digits representing the absolute value.